diff options
| author | Kyle Tso <[email protected]> | 2020-07-14 11:34:53 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2020-07-21 13:38:21 +0200 |
| commit | d25d61be6bed44d3a5b7050836e6df602bf3d6ba (patch) | |
| tree | c2c93906ea60f2fee315875c6353a42ffe6bcac4 | |
| parent | 1401bfe058d3ccf8867e9faf77744900c305e74e (diff) | |
usb: typec: tcpm: Error handling for tcpm_register_partner_altmodes
typec_partner_register_altmode returns ERR_PTR. Reset the pointer
altmode to NULL on failure.
Signed-off-by: Kyle Tso <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
| -rw-r--r-- | drivers/usb/typec/tcpm/tcpm.c | 4 |
1 files changed, 3 insertions, 1 deletions
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; } } |