Re: [PATCH 2/3] usb: typec: anx7411: fix passing a valid pointer to 'PTR_ERR'

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

 



On Fri, Jul 22, 2022 at 04:18:35PM +0800, Xin Ji wrote:
> Fix anx7411_typec_register_altmode() warn: passing a valid pointer to
> 'PTR_ERR'.
> 
> Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
> Signed-off-by: Xin Ji <xji@xxxxxxxxxxxxxxxx>
> ---
>  drivers/usb/typec/anx7411.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
> index 7b45d7440a9d..dc86b6704cbd 100644
> --- a/drivers/usb/typec/anx7411.c
> +++ b/drivers/usb/typec/anx7411.c
> @@ -550,6 +550,7 @@ static int anx7411_typec_register_altmode(struct anx7411_data *ctx,
>  {
>  	struct device *dev = &ctx->spi_client->dev;
>  	struct typec_altmode_desc desc;
> +	struct typec_altmode *alt;
>  	int i;
>  
>  	desc.svid = svid;
> @@ -566,14 +567,14 @@ static int anx7411_typec_register_altmode(struct anx7411_data *ctx,
>  		return -ENOMEM;
>  	}
>  
> -	ctx->typec.amode[i] = typec_partner_register_altmode(ctx->typec.partner,
> -							     &desc);
> -	if (IS_ERR(ctx->typec.amode[i])) {
> +	alt = typec_partner_register_altmode(ctx->typec.partner, &desc);
> +	if (IS_ERR(alt)) {
>  		dev_err(dev, "failed to register altmode\n");
> -		ctx->typec.amode[i] = NULL;
> -		return PTR_ERR(ctx->typec.amode);
> +		return PTR_ERR(alt);
>  	}
>  
> +	ctx->typec.amode[i] = alt;
> +
>  	return 0;
>  }
>  
> -- 
> 2.25.1
> 

Does not apply to my tree :(



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

  Powered by Linux