Re: [bug report] usb: ucsi_acpi: Quirk to ack a connector change ack cmd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,

On Thu, Feb 01, 2024 at 12:33:30PM +0300, Dan Carpenter wrote:
> Ah, thanks for the explanation.  I misread the code.  To be honest we
> spent an embarrasing long time looking at this code.  At first that
> Smatch was wrong and that ret could be -ETIMEDOUT and went down a whole
> long rabbit hole trying to debug that.  :P  What about if we did this
> instead?
> 
> I can send this as a proper patch if you're okay with it.
> 
> regards,
> dan carpenter
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
> index 928eacbeb21a..5251132cb35b 100644
> --- a/drivers/usb/typec/ucsi/ucsi_acpi.c
> +++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
> @@ -153,6 +153,9 @@ ucsi_dell_sync_write(struct ucsi *ucsi, unsigned int offset,
>  	if (ack == 0)
>  		return ret;
>  
> +	if (ua->dell_quirk_probed && !ua->dell_quirk_active)
> +		return 0;
> +
>  	if (!ua->dell_quirk_probed) {
>  		ua->dell_quirk_probed = true;
>  
> @@ -170,9 +173,6 @@ ucsi_dell_sync_write(struct ucsi *ucsi, unsigned int offset,
>  		dev_err(ua->dev, "Firmware bug: Enabling workaround\n");
>  	}
>  
> -	if (!ua->dell_quirk_active)
> -		return ret;
> -
>  	return ucsi_acpi_sync_write(ucsi, UCSI_CONTROL, &ack, sizeof(ack));
>  }

It's not my preferred solution but it looks correct, so go ahead.
I will review the final patch.

Thanks  Christian





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux