patch "usb: typec: ucsi: Put fwnode in any case during ->probe()" added to usb-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
usb: typec: ucsi: Put fwnode in any case during ->probe()
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From b9a0866a5bdf6a4643a52872ada6be6184c6f4f2 Mon Sep 17 00:00:00 2001
From: Andy Shevchenko <[email protected]>
Date: Wed, 5 May 2021 01:23:37 +0300
Subject: usb: typec: ucsi: Put fwnode in any case during ->probe()
device_for_each_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller.
--- drivers/usb/typec/ucsi/ucsi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi.c +4 -1
@@ -999,6 +999,7 @@ static const struct typec_operations ucsi_ops = { .pr_set = ucsi_pr_swap }; +/* Caller must call fwnode_handle_put() after use */ static struct fwnode_handle *ucsi_find_fwnode (struct ucsi_connector *con) {struct fwnode_handle *fwnode;
@@ -1033,7 +1034,7 @@ static int ucsi_register_port(struct ucsi *ucsi, int index) command |=UCSI_CONNECTOR_NUMBER (con->num); ret =ucsi_send_command (ucsi, command, &con->cap,sizeof (con->cap));if (ret <0 ) - goto out; + goto out_unlock;if (con->cap.op_mode &UCSI_CONCAP_OPMODE_DRP ) cap->data =TYPEC_PORT_DRD ;
@@ -1151,6 +1152,8 @@ static int ucsi_register_port(struct ucsi *ucsi, int index)trace_ucsi_register_port (con->num, &con->status); out: +fwnode_handle_put (cap->fwnode); +out_unlock:mutex_unlock (&con->lock);return ret; }
Signature · 1 line
2.31.1