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 <kyletso@google.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20200714033453.4044482-3-kyletso@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1401bfe058
commit
d25d61be6b
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue