public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Prashant Malani <pmalani@chromium.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-kernel@vger.kernel.org, Benson Leung <bleung@chromium.org>,
	Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	Guenter Roeck <groeck@chromium.org>
Subject: Re: [PATCH v1 1/1] platform/chrome: cros_ec_typec: Put fwnode in error case during ->probe()
Date: Mon, 14 Jun 2021 14:33:25 -0700	[thread overview]
Message-ID: <YMfLJbTUqyKAcBeu@google.com> (raw)
In-Reply-To: <20210614203310.339541-1-andy.shevchenko@gmail.com>

Hi Andy,

On Mon, Jun 14, 2021 at 11:33:10PM +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: fdc6b21e2444 ("platform/chrome: Add Type C connector class driver")
> Cc: Prashant Malani <pmalani@chromium.org>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Minor nit, but regardless of that:
Reviewed-by: Prashant Malani <pmalani@chromium.org>

> ---
>  drivers/platform/chrome/cros_ec_typec.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index 27c068c4c38d..fb03c22fa34d 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -375,6 +375,7 @@ static int cros_typec_init_ports(struct cros_typec_data *typec)
>  	return 0;
>  
>  unregister_ports:
> +	fwnode_handle_put(fwnode);

It reads better to have this at the location where the goto's are called, but
there are several of them. Instead, can you add a 1-line comment explaining that
the reference is left over? It isn't clear even by going a few calls down the
stack of device_for_each_child_node().


Best regards,

-Prashant

      reply	other threads:[~2021-06-14 21:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 20:33 [PATCH v1 1/1] platform/chrome: cros_ec_typec: Put fwnode in error case during ->probe() Andy Shevchenko
2021-06-14 21:33 ` Prashant Malani [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=YMfLJbTUqyKAcBeu@google.com \
    --to=pmalani@chromium.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=bleung@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=linux-kernel@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