aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorGravatar Kyle Tso <kyletso@google.com> 2024-03-12 01:23:06 +0800
committerGravatar Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2024-03-26 11:02:18 +0100
commit17af5050dead6cbcca12c1fcd17e0bb8bb284eae (patch)
tree9fadecd1005dbc4b503095cd2d36a21136a5d0b4 /drivers/usb
parentusb: typec: tcpm: fix double-free issue in tcpm_port_unregister_pd() (diff)
downloadlinux-17af5050dead6cbcca12c1fcd17e0bb8bb284eae.tar.gz
linux-17af5050dead6cbcca12c1fcd17e0bb8bb284eae.tar.bz2
linux-17af5050dead6cbcca12c1fcd17e0bb8bb284eae.zip
usb: typec: tcpm: Update PD of Type-C port upon pd_set
The PD of Type-C port needs to be updated in pd_set. Unlink the Type-C port device to the old PD before linking it to a new one. Fixes: cd099cde4ed2 ("usb: typec: tcpm: Support multiple capabilities") Cc: stable@vger.kernel.org Signed-off-by: Kyle Tso <kyletso@google.com> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20240311172306.3911309-1-kyletso@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/typec/tcpm/tcpm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 64cbcab6f46a..c26fb70c3ec6 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -6910,7 +6910,9 @@ static int tcpm_pd_set(struct typec_port *p, struct usb_power_delivery *pd)
port->port_source_caps = data->source_cap;
port->port_sink_caps = data->sink_cap;
+ typec_port_set_usb_power_delivery(p, NULL);
port->selected_pd = pd;
+ typec_port_set_usb_power_delivery(p, port->selected_pd);
unlock:
mutex_unlock(&port->lock);
return ret;