From: Yixun Lan <dlan@gentoo.org>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
linux-gpio@vger.kernel.org, linux-riscv@lists.infradead.org,
spacemit@lists.linux.dev, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH] pinctrl: spacemit: destroy mutex at driver detach
Date: Wed, 5 Mar 2025 10:34:58 +0000 [thread overview]
Message-ID: <20250305103458-GYA63227@gentoo> (raw)
In-Reply-To: <20250305102710.52762-1-brgl@bgdev.pl>
On 11:27 Wed 05 Mar , Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> The mutex initialized in probe() is never cleaned up. Use
> devm_mutex_init() to destroy it automatically.
>
Reviewed-by: Yixun Lan <dlan@gentoo.org>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> drivers/pinctrl/spacemit/pinctrl-k1.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/spacemit/pinctrl-k1.c b/drivers/pinctrl/spacemit/pinctrl-k1.c
> index 59fd555ff38d..67e867b04a02 100644
> --- a/drivers/pinctrl/spacemit/pinctrl-k1.c
> +++ b/drivers/pinctrl/spacemit/pinctrl-k1.c
> @@ -9,6 +9,7 @@
> #include <linux/seq_file.h>
> #include <linux/spinlock.h>
> #include <linux/module.h>
> +#include <linux/mutex.h>
>
> #include <linux/pinctrl/pinconf-generic.h>
> #include <linux/pinctrl/pinconf.h>
> @@ -749,7 +750,10 @@ static int spacemit_pinctrl_probe(struct platform_device *pdev)
> pctrl->data = pctrl_data;
> pctrl->dev = dev;
> raw_spin_lock_init(&pctrl->lock);
> - mutex_init(&pctrl->mutex);
> +
> + ret = devm_mutex_init(dev, &pctrl->mutex);
> + if (ret)
> + return ret;
>
> platform_set_drvdata(pdev, pctrl);
>
> --
> 2.45.2
>
--
Yixun Lan (dlan)
Gentoo Linux Developer
GPG Key ID AABEFD55
next prev parent reply other threads:[~2025-03-05 10:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-05 10:27 [PATCH] pinctrl: spacemit: destroy mutex at driver detach Bartosz Golaszewski
2025-03-05 10:34 ` Yixun Lan [this message]
2025-03-05 13:31 ` Javier Martinez Canillas
2025-03-14 10:02 ` Linus Walleij
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=20250305103458-GYA63227@gentoo \
--to=dlan@gentoo.org \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=spacemit@lists.linux.dev \
/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