linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Kyle Tso <kyletso@google.com>
Cc: linux@roeck-us.net, gregkh@linuxfoundation.org,
	badhri@google.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] usb: typec: tcpm: Error handling for tcpm_register_partner_altmodes
Date: Tue, 28 Jul 2020 14:56:46 +0300	[thread overview]
Message-ID: <20200728115646.GE883641@kuha.fi.intel.com> (raw)
In-Reply-To: <20200714033453.4044482-3-kyletso@google.com>

On Tue, Jul 14, 2020 at 11:34:53AM +0800, Kyle Tso wrote:
> typec_partner_register_altmode returns ERR_PTR. Reset the pointer
> altmode to NULL on failure.
> 
> Signed-off-by: Kyle Tso <kyletso@google.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 82b19ebd7838..a6d4b03ec250 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -1061,9 +1061,11 @@ static void tcpm_register_partner_altmodes(struct tcpm_port *port)
>  	for (i = 0; i < modep->altmodes; i++) {
>  		altmode = typec_partner_register_altmode(port->partner,
>  						&modep->altmode_desc[i]);
> -		if (!altmode)
> +		if (IS_ERR(altmode)) {
>  			tcpm_log(port, "Failed to register partner SVID 0x%04x",
>  				 modep->altmode_desc[i].svid);
> +			altmode = NULL;
> +		}
>  		port->partner_altmode[i] = altmode;
>  	}
>  }
> -- 
> 2.27.0.389.gc38d7665816-goog

thanks,

-- 
heikki

  parent reply	other threads:[~2020-07-28 11:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14  3:34 [PATCH 0/2] tcpm: Error handling for tcpm_register_partner_altmodes Kyle Tso
2020-07-14  3:34 ` [PATCH 1/2] usb: typec: Comment correction for typec_partner_register_altmode Kyle Tso
2020-07-14  6:48   ` Guenter Roeck
2020-07-28 11:56   ` Heikki Krogerus
2020-07-14  3:34 ` [PATCH 2/2] usb: typec: tcpm: Error handling for tcpm_register_partner_altmodes Kyle Tso
2020-07-14  6:49   ` Guenter Roeck
2020-07-28 11:56   ` Heikki Krogerus [this message]
2020-07-14  6:02 ` [PATCH 0/2] " Greg KH

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=20200728115646.GE883641@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kyletso@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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).