mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
usb: typec: ucsi: Put fwnode in any case during ->probe()
commitb9a0866a5bupstream. device_for_each_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller. Fixes:c1b0bc2dab("usb: typec: Add support for UCSI interface") Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210504222337.3151726-1-andy.shevchenko@gmail.com Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e5366bea02
commit
fa4b136325
|
|
@ -910,6 +910,7 @@ static const struct typec_operations ucsi_ops = {
|
||||||
.pr_set = ucsi_pr_swap
|
.pr_set = ucsi_pr_swap
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Caller must call fwnode_handle_put() after use */
|
||||||
static struct fwnode_handle *ucsi_find_fwnode(struct ucsi_connector *con)
|
static struct fwnode_handle *ucsi_find_fwnode(struct ucsi_connector *con)
|
||||||
{
|
{
|
||||||
struct fwnode_handle *fwnode;
|
struct fwnode_handle *fwnode;
|
||||||
|
|
@ -943,7 +944,7 @@ static int ucsi_register_port(struct ucsi *ucsi, int index)
|
||||||
command |= UCSI_CONNECTOR_NUMBER(con->num);
|
command |= UCSI_CONNECTOR_NUMBER(con->num);
|
||||||
ret = ucsi_send_command(ucsi, command, &con->cap, sizeof(con->cap));
|
ret = ucsi_send_command(ucsi, command, &con->cap, sizeof(con->cap));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out_unlock;
|
||||||
|
|
||||||
if (con->cap.op_mode & UCSI_CONCAP_OPMODE_DRP)
|
if (con->cap.op_mode & UCSI_CONCAP_OPMODE_DRP)
|
||||||
cap->data = TYPEC_PORT_DRD;
|
cap->data = TYPEC_PORT_DRD;
|
||||||
|
|
@ -1039,6 +1040,8 @@ static int ucsi_register_port(struct ucsi *ucsi, int index)
|
||||||
trace_ucsi_register_port(con->num, &con->status);
|
trace_ucsi_register_port(con->num, &con->status);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
fwnode_handle_put(cap->fwnode);
|
||||||
|
out_unlock:
|
||||||
mutex_unlock(&con->lock);
|
mutex_unlock(&con->lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user