[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200728115646.GE883641@kuha.fi.intel.com>
Date: Tue, 28 Jul 2020 14:56:46 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Kyle Tso <kyletso@...gle.com>
Cc: linux@...ck-us.net, gregkh@...uxfoundation.org, 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 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@...gle.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.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
Powered by blists - more mailing lists