From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/1] usb: typec: ucsi: Put fwnode in any case during ->probe()
Date: Wed, 5 May 2021 10:09:08 +0300 [thread overview]
Message-ID: <YJJElG8aneXeC/Ij@kuha.fi.intel.com> (raw)
In-Reply-To: <20210504222337.3151726-1-andy.shevchenko@gmail.com>
Hi Andy,
On Wed, May 05, 2021 at 01:23:37AM +0300, Andy Shevchenko wrote:
> 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: c1b0bc2dabfa ("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>
> ---
> drivers/usb/typec/ucsi/ucsi.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index 282c3c825c13..0e1cec346e0f 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -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;
> }
> --
> 2.31.1
thanks,
--
heikki
prev parent reply other threads:[~2021-05-05 7:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-04 22:23 [PATCH v1 1/1] usb: typec: ucsi: Put fwnode in any case during ->probe() Andy Shevchenko
2021-05-05 7:09 ` Heikki Krogerus [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YJJElG8aneXeC/Ij@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox