* [bug report] hwmon: Add hardware monitoring driver for Moortec MR75203 PVT controller
@ 2020-10-13 14:08 Dan Carpenter
2020-10-13 16:57 ` Guenter Roeck
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2020-10-13 14:08 UTC (permalink / raw)
To: rahul.tanwar; +Cc: linux-hwmon
Hello Rahul Tanwar,
The patch 9d823351a337: "hwmon: Add hardware monitoring driver for
Moortec MR75203 PVT controller" from Oct 5, 2020, leads to the
following static checker warning:
drivers/hwmon/mr75203.c:479 pvt_clk_enable()
warn: 'pvt->clk' not released on lines: 479.
drivers/hwmon/mr75203.c
471 static int pvt_clk_enable(struct device *dev, struct pvt_device *pvt)
472 {
473 int ret;
474
475 ret = clk_prepare_enable(pvt->clk);
476 if (ret)
477 return ret;
478
479 return devm_add_action_or_reset(dev, pvt_clk_disable, pvt);
Do we have to disable the clock if devm_add_action_or_reset() fails?
This is sort of a new Smatch check so I'm not entirely sure of the rules
mysql.
480 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [bug report] hwmon: Add hardware monitoring driver for Moortec MR75203 PVT controller
2020-10-13 14:08 [bug report] hwmon: Add hardware monitoring driver for Moortec MR75203 PVT controller Dan Carpenter
@ 2020-10-13 16:57 ` Guenter Roeck
2020-10-13 18:43 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2020-10-13 16:57 UTC (permalink / raw)
To: Dan Carpenter; +Cc: rahul.tanwar, linux-hwmon
On Tue, Oct 13, 2020 at 05:08:58PM +0300, Dan Carpenter wrote:
> Hello Rahul Tanwar,
>
> The patch 9d823351a337: "hwmon: Add hardware monitoring driver for
> Moortec MR75203 PVT controller" from Oct 5, 2020, leads to the
> following static checker warning:
>
> drivers/hwmon/mr75203.c:479 pvt_clk_enable()
> warn: 'pvt->clk' not released on lines: 479.
>
> drivers/hwmon/mr75203.c
> 471 static int pvt_clk_enable(struct device *dev, struct pvt_device *pvt)
> 472 {
> 473 int ret;
> 474
> 475 ret = clk_prepare_enable(pvt->clk);
> 476 if (ret)
> 477 return ret;
> 478
> 479 return devm_add_action_or_reset(dev, pvt_clk_disable, pvt);
>
> Do we have to disable the clock if devm_add_action_or_reset() fails?
> This is sort of a new Smatch check so I'm not entirely sure of the rules
> mysql.
devm_add_action_or_reset calls the callback function (here:
pvt_clk_disable) if there is an error, and the callback function
releases the clock. This is a workaround for the missing
devm_clk_prepare_enable(); you'll find it all over the kernel
by now.
Guenter
>
> 480 }
>
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [bug report] hwmon: Add hardware monitoring driver for Moortec MR75203 PVT controller
2020-10-13 16:57 ` Guenter Roeck
@ 2020-10-13 18:43 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-10-13 18:43 UTC (permalink / raw)
To: Guenter Roeck; +Cc: rahul.tanwar, linux-hwmon
On Tue, Oct 13, 2020 at 09:57:14AM -0700, Guenter Roeck wrote:
> On Tue, Oct 13, 2020 at 05:08:58PM +0300, Dan Carpenter wrote:
> > Hello Rahul Tanwar,
> >
> > The patch 9d823351a337: "hwmon: Add hardware monitoring driver for
> > Moortec MR75203 PVT controller" from Oct 5, 2020, leads to the
> > following static checker warning:
> >
> > drivers/hwmon/mr75203.c:479 pvt_clk_enable()
> > warn: 'pvt->clk' not released on lines: 479.
> >
> > drivers/hwmon/mr75203.c
> > 471 static int pvt_clk_enable(struct device *dev, struct pvt_device *pvt)
> > 472 {
> > 473 int ret;
> > 474
> > 475 ret = clk_prepare_enable(pvt->clk);
> > 476 if (ret)
> > 477 return ret;
> > 478
> > 479 return devm_add_action_or_reset(dev, pvt_clk_disable, pvt);
> >
> > Do we have to disable the clock if devm_add_action_or_reset() fails?
> > This is sort of a new Smatch check so I'm not entirely sure of the rules
> > mysql.
>
> devm_add_action_or_reset calls the callback function (here:
> pvt_clk_disable) if there is an error, and the callback function
> releases the clock. This is a workaround for the missing
> devm_clk_prepare_enable(); you'll find it all over the kernel
> by now.
Ah right. I have seen that before, yes.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-13 18:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13 14:08 [bug report] hwmon: Add hardware monitoring driver for Moortec MR75203 PVT controller Dan Carpenter
2020-10-13 16:57 ` Guenter Roeck
2020-10-13 18:43 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.