linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Xin Ji <xji@analogixsemi.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	bliang@analogixsemi.com, qwen@analogixsemi.com,
	jli@analogixsemi.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] usb: typec: anx7411: fix passing a valid pointer to 'PTR_ERR'
Date: Wed, 27 Jul 2022 14:28:36 +0200	[thread overview]
Message-ID: <YuEvdKTVNwY3eX4p@kroah.com> (raw)
In-Reply-To: <20220722081836.3380885-2-xji@analogixsemi.com>

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@analogixsemi.com>
> ---
>  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 :(

  reply	other threads:[~2022-07-27 12:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22  8:18 [PATCH 1/3] usb: typec: anx7411: fix passing zero to 'PTR_ERR' Xin Ji
2022-07-22  8:18 ` [PATCH 2/3] usb: typec: anx7411: fix passing a valid pointer " Xin Ji
2022-07-27 12:28   ` Greg Kroah-Hartman [this message]
2022-07-22  8:18 ` [PATCH 3/3] usb: typec: anx7411: fix missing error code 'ret' Xin Ji

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YuEvdKTVNwY3eX4p@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bliang@analogixsemi.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jli@analogixsemi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=qwen@analogixsemi.com \
    --cc=xji@analogixsemi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).