[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <de0ea27c-0e73-6e8e-b7b5-fda4a0f4f545@roeck-us.net>
Date: Mon, 13 Jul 2020 23:49:06 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Kyle Tso <kyletso@...gle.com>, heikki.krogerus@...ux.intel.com,
gregkh@...uxfoundation.org
Cc: badhri@...gle.com, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] usb: typec: tcpm: Error handling for
tcpm_register_partner_altmodes
On 7/13/20 8:34 PM, Kyle Tso wrote:
> typec_partner_register_altmode returns ERR_PTR. Reset the pointer
> altmode to NULL on failure.
>
> Signed-off-by: Kyle Tso <kyletso@...gle.com>
Reviewed-by: Guenter Roeck <linux@...ck-us.net>
> ---
> 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;
> }
> }
>
Powered by blists - more mailing lists