mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
FROMLIST: usb: typec: fix up incorrectly backported "usb: typec: tcpm: unregister existing source caps before re-registration"
In commitcfcd544a99("usb: typec: tcpm: unregister existing source caps before re-registration"), quilt, and git, applied the diff to the incorrect function, which would cause bad problems if exercised in a device with these capabilities. Fix this all up to be in the correct function. Fixes:cfcd544a99("usb: typec: tcpm: unregister existing source caps before re-registration") Reported-by: Charles Yo <charlesyo@google.com> Cc: Kyle Tso <kyletso@google.com> Cc: Amit Sunil Dhamne <amitsd@google.com> Cc: Ondrej Jirman <megi@xff.cz> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/linux-usb/2024083008-granddad-unmoving-828c@gregkh/ Bug: 363121994 [ note, only 1/3 of the upstream commit is needed here due to half already being present due to manual UPSTREAM changes made to the tree, and a second follow-up fix not being merged from LTS here yet - gregkh] Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I33b07fcb8d1e64e7f0424b9a7b7d056aa9e44b2f
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
841cae8810
commit
b5e374dda9
@@ -2453,7 +2453,7 @@ static int tcpm_register_sink_caps(struct tcpm_port *port)
|
||||
{
|
||||
struct usb_power_delivery_desc desc = { port->negotiated_rev };
|
||||
struct usb_power_delivery_capabilities_desc caps = { };
|
||||
struct usb_power_delivery_capabilities *cap = port->partner_source_caps;
|
||||
struct usb_power_delivery_capabilities *cap;
|
||||
|
||||
if (!port->partner_pd)
|
||||
port->partner_pd = usb_power_delivery_register(NULL, &desc);
|
||||
@@ -2463,9 +2463,6 @@ static int tcpm_register_sink_caps(struct tcpm_port *port)
|
||||
memcpy(caps.pdo, port->sink_caps, sizeof(u32) * port->nr_sink_caps);
|
||||
caps.role = TYPEC_SINK;
|
||||
|
||||
if (cap)
|
||||
usb_power_delivery_unregister_capabilities(cap);
|
||||
|
||||
cap = usb_power_delivery_register_capabilities(port->partner_pd, &caps);
|
||||
if (IS_ERR(cap))
|
||||
return PTR_ERR(cap);
|
||||
|
||||
Reference in New Issue
Block a user