Commit d25d61be authored by Kyle Tso's avatar Kyle Tso Committed by Greg Kroah-Hartman

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: default avatarKyle Tso <kyletso@google.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20200714033453.4044482-3-kyletso@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1401bfe0
......@@ -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;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment