[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e9991ab5-cb55-789a-dfa1-de10acb37842@wanadoo.fr>
Date: Fri, 26 Aug 2022 14:18:11 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Linus Walleij <linus.walleij@...aro.org>,
Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Bartosz Golaszewski <brgl@...ev.pl>,
Robert Jarzmik <robert.jarzmik@...e.fr>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Hulk Robot <hulkci@...wei.com>, Yuan Can <yuancan@...wei.com>,
Kernel Janitors <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH] gpio: pxa: use devres for the clock struct
Le 26/08/2022 à 10:20, Linus Walleij a écrit :
> On Sat, Aug 20, 2022 at 12:15 AM Andy Shevchenko
> <andy.shevchenko@...il.com> wrote:
>> On Mon, Aug 15, 2022 at 12:26 PM Bartosz Golaszewski <brgl@...ev.pl> wrote:
>>>
>>> The clock is never released after probe(). Use devres to not leak
>>> resources.
>>
>> ...
>>
>>> - clk = clk_get(&pdev->dev, NULL);
>>> + clk = devm_clk_get_enabled(&pdev->dev, NULL);
>>> if (IS_ERR(clk)) {
>>> dev_err(&pdev->dev, "Error %ld to get gpio clock\n",
>>> PTR_ERR(clk));
>>> return PTR_ERR(clk);
>>
>> Shouldn't we fix a potential log saturation issue first (by switching
>> to use dev_err_probe() helper)?
>
> Can be a separate patch, the clock mem leak is a bigger problem
> IMO so this should be applied first.
>
> Hm isn't it possible to toss the task of fixing a gazillion
> dev_err_probe() messages on Cocinelle scripts/coccinelle/? I bet it's something
> the kernel janitors could fix all over the place.
>
> Yours,
> Linus Walleij
>
Not perfect and certainly incomplete, but gives an idea:
@@
expression x, dev, e, str;
@@
(
x = devm_clk_get(dev, e);
|
x = clk_get(dev, e);
)
- if (IS_ERR(x)) {
- dev_err(dev, str);
- return PTR_ERR(x);
- }
+ if (IS_ERR(x))
+ return dev_err_probe(dev, PTR_ERR(x), str);
// This rule only: 291 files changed, 1233 insertions(+), 1634 deletions(-)
// The output of this rule needs to be adjusted to fix the 'str'. The
// error code and related text have to be manually removed
@@
expression x, dev, e, str;
@@
(
x = devm_clk_get(dev, e);
|
x = clk_get(dev, e);
)
- if (IS_ERR(x)) {
- dev_err(dev, str, PTR_ERR(x));
- return PTR_ERR(x);
- }
+ if (IS_ERR(x))
+ return dev_err_probe(dev, PTR_ERR(x), str);
// Both rules: 316 files changed, 1321 insertions(+), 1774 deletions(-)
Powered by blists - more mailing lists