linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Chunyan Zhang <chunyan.zhang@unisoc.com>
Cc: Pavel Machek <pavel@ucw.cz>,
	linux-leds@vger.kernel.org,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] leds: sc27xx: Add a missing mutex_destory()
Date: Thu, 21 Sep 2023 13:05:46 +0100	[thread overview]
Message-ID: <20230921120546.GI3449785@google.com> (raw)
In-Reply-To: <20230921024314.615370-1-chunyan.zhang@unisoc.com>

On Thu, 21 Sep 2023, Chunyan Zhang wrote:

> In sc27xx_led_probe() there's one error branch missing mutex_destory()
> after mutex_init(), it seems that we should add it since other branches
> which follow it called mutex_destoy() before return failure.

Wouldn't it be better to move the mutex_init() to the end of .probe()?

> Fixes: e081c49e30ec ("leds: Add Spreadtrum SC27xx breathing light controller driver")
> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> ---
>  drivers/leds/leds-sc27xx-bltc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/leds/leds-sc27xx-bltc.c b/drivers/leds/leds-sc27xx-bltc.c
> index e199ea15e406..122094bbf444 100644
> --- a/drivers/leds/leds-sc27xx-bltc.c
> +++ b/drivers/leds/leds-sc27xx-bltc.c
> @@ -300,6 +300,7 @@ static int sc27xx_led_probe(struct platform_device *pdev)
>  	priv->base = base;
>  	priv->regmap = dev_get_regmap(dev->parent, NULL);
>  	if (!priv->regmap) {
> +		mutex_destroy(&priv->lock);
>  		err = -ENODEV;
>  		dev_err(dev, "failed to get regmap: %d\n", err);
>  		return err;
> -- 
> 2.41.0
> 

-- 
Lee Jones [李琼斯]

      reply	other threads:[~2023-09-21 20:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21  2:43 [PATCH] leds: sc27xx: Add a missing mutex_destory() Chunyan Zhang
2023-09-21 12:05 ` Lee Jones [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=20230921120546.GI3449785@google.com \
    --to=lee@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=chunyan.zhang@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=zhang.lyra@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).