* [PATCH] thermal/drivers/mediatek: remove redundant dev_warn in probe
@ 2023-08-13 19:08 Alexandru Ardelean
2023-08-14 5:20 ` Chen-Yu Tsai
0 siblings, 1 reply; 3+ messages in thread
From: Alexandru Ardelean @ 2023-08-13 19:08 UTC (permalink / raw)
To: linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek
Cc: rafael, daniel.lezcano, amitk, rui.zhang, matthias.bgg,
angelogioacchino.delregno, aouledameur, daniel, void0red,
aboutphysycs, Alexandru Ardelean
There's no need to print any extra messages in the driver if
devm_thermal_add_hwmon_sysfs() fails.
If this function has any failures, they will already be printed.
While looking inside 'drivers/thermal/mediatek/auxadc_thermal.c', the
failure will be either be one of:
'Failed to allocate device resource data'
or
'Failed to add hwmon sysfs attributes'
Also, the failure will be reported on the 'dev' object passed to
'devm_thermal_add_hwmon_sysfs()', so it should be clear which device this
error belongs to.
Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
---
drivers/thermal/mediatek/auxadc_thermal.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c
index f59d36de20a0..55f7fde470e5 100644
--- a/drivers/thermal/mediatek/auxadc_thermal.c
+++ b/drivers/thermal/mediatek/auxadc_thermal.c
@@ -1290,11 +1290,7 @@ static int mtk_thermal_probe(struct platform_device *pdev)
if (IS_ERR(tzdev))
return PTR_ERR(tzdev);
- ret = devm_thermal_add_hwmon_sysfs(&pdev->dev, tzdev);
- if (ret)
- dev_warn(&pdev->dev, "error in thermal_add_hwmon_sysfs");
-
- return 0;
+ return devm_thermal_add_hwmon_sysfs(&pdev->dev, tzdev);
}
static struct platform_driver mtk_thermal_driver = {
--
2.41.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] thermal/drivers/mediatek: remove redundant dev_warn in probe
2023-08-13 19:08 [PATCH] thermal/drivers/mediatek: remove redundant dev_warn in probe Alexandru Ardelean
@ 2023-08-14 5:20 ` Chen-Yu Tsai
2023-08-14 6:16 ` Alexandru Ardelean
0 siblings, 1 reply; 3+ messages in thread
From: Chen-Yu Tsai @ 2023-08-14 5:20 UTC (permalink / raw)
To: Alexandru Ardelean
Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek, rafael,
daniel.lezcano, amitk, rui.zhang, matthias.bgg,
angelogioacchino.delregno, aouledameur, daniel, void0red,
aboutphysycs
On Mon, Aug 14, 2023 at 3:09 AM Alexandru Ardelean <alex@shruggie.ro> wrote:
>
> There's no need to print any extra messages in the driver if
> devm_thermal_add_hwmon_sysfs() fails.
> If this function has any failures, they will already be printed.
>
> While looking inside 'drivers/thermal/mediatek/auxadc_thermal.c', the
> failure will be either be one of:
> 'Failed to allocate device resource data'
> or
> 'Failed to add hwmon sysfs attributes'
>
> Also, the failure will be reported on the 'dev' object passed to
> 'devm_thermal_add_hwmon_sysfs()', so it should be clear which device this
> error belongs to.
>
> Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
> ---
> drivers/thermal/mediatek/auxadc_thermal.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c
> index f59d36de20a0..55f7fde470e5 100644
> --- a/drivers/thermal/mediatek/auxadc_thermal.c
> +++ b/drivers/thermal/mediatek/auxadc_thermal.c
> @@ -1290,11 +1290,7 @@ static int mtk_thermal_probe(struct platform_device *pdev)
> if (IS_ERR(tzdev))
> return PTR_ERR(tzdev);
>
> - ret = devm_thermal_add_hwmon_sysfs(&pdev->dev, tzdev);
> - if (ret)
> - dev_warn(&pdev->dev, "error in thermal_add_hwmon_sysfs");
> -
> - return 0;
> + return devm_thermal_add_hwmon_sysfs(&pdev->dev, tzdev);
You changed the logic here. The original logic is to print a warning
if the hwmon sysfs stuff failed, but continue to probe the driver. In
other words, hwmon sysfs failing is a non-fatal error.
Your changes make it fatal.
ChenYu
> }
>
> static struct platform_driver mtk_thermal_driver = {
> --
> 2.41.0
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] thermal/drivers/mediatek: remove redundant dev_warn in probe
2023-08-14 5:20 ` Chen-Yu Tsai
@ 2023-08-14 6:16 ` Alexandru Ardelean
0 siblings, 0 replies; 3+ messages in thread
From: Alexandru Ardelean @ 2023-08-14 6:16 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek, rafael,
daniel.lezcano, amitk, rui.zhang, matthias.bgg,
angelogioacchino.delregno, aouledameur, daniel, void0red,
aboutphysycs
On Mon, Aug 14, 2023 at 8:20 AM Chen-Yu Tsai <wenst@chromium.org> wrote:
>
> On Mon, Aug 14, 2023 at 3:09 AM Alexandru Ardelean <alex@shruggie.ro> wrote:
> >
> > There's no need to print any extra messages in the driver if
> > devm_thermal_add_hwmon_sysfs() fails.
> > If this function has any failures, they will already be printed.
> >
> > While looking inside 'drivers/thermal/mediatek/auxadc_thermal.c', the
> > failure will be either be one of:
> > 'Failed to allocate device resource data'
> > or
> > 'Failed to add hwmon sysfs attributes'
> >
> > Also, the failure will be reported on the 'dev' object passed to
> > 'devm_thermal_add_hwmon_sysfs()', so it should be clear which device this
> > error belongs to.
> >
> > Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
> > ---
> > drivers/thermal/mediatek/auxadc_thermal.c | 6 +-----
> > 1 file changed, 1 insertion(+), 5 deletions(-)
> >
> > diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c
> > index f59d36de20a0..55f7fde470e5 100644
> > --- a/drivers/thermal/mediatek/auxadc_thermal.c
> > +++ b/drivers/thermal/mediatek/auxadc_thermal.c
> > @@ -1290,11 +1290,7 @@ static int mtk_thermal_probe(struct platform_device *pdev)
> > if (IS_ERR(tzdev))
> > return PTR_ERR(tzdev);
> >
> > - ret = devm_thermal_add_hwmon_sysfs(&pdev->dev, tzdev);
> > - if (ret)
> > - dev_warn(&pdev->dev, "error in thermal_add_hwmon_sysfs");
> > -
> > - return 0;
> > + return devm_thermal_add_hwmon_sysfs(&pdev->dev, tzdev);
>
> You changed the logic here. The original logic is to print a warning
> if the hwmon sysfs stuff failed, but continue to probe the driver. In
> other words, hwmon sysfs failing is a non-fatal error.
>
> Your changes make it fatal.
Ah, right.
My bad
>
> ChenYu
>
> > }
> >
> > static struct platform_driver mtk_thermal_driver = {
> > --
> > 2.41.0
> >
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-14 6:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-13 19:08 [PATCH] thermal/drivers/mediatek: remove redundant dev_warn in probe Alexandru Ardelean
2023-08-14 5:20 ` Chen-Yu Tsai
2023-08-14 6:16 ` Alexandru Ardelean
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®