All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Ardelean <alex@shruggie.ro>
To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Cc: rafael@kernel.org, daniel.lezcano@linaro.org, amitk@kernel.org,
	rui.zhang@intel.com, matthias.bgg@gmail.com,
	angelogioacchino.delregno@collabora.com,
	aouledameur@baylibre.com, daniel@makrotopia.org,
	void0red@hust.edu.cn, aboutphysycs@gmail.com,
	Alexandru Ardelean <alex@shruggie.ro>
Subject: [PATCH] thermal/drivers/mediatek: remove redundant dev_warn in probe
Date: Sun, 13 Aug 2023 22:08:45 +0300	[thread overview]
Message-ID: <20230813190845.49738-1-alex@shruggie.ro> (raw)

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


WARNING: multiple messages have this Message-ID (diff)
From: Alexandru Ardelean <alex@shruggie.ro>
To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Cc: rafael@kernel.org, daniel.lezcano@linaro.org, amitk@kernel.org,
	rui.zhang@intel.com, matthias.bgg@gmail.com,
	angelogioacchino.delregno@collabora.com,
	aouledameur@baylibre.com, daniel@makrotopia.org,
	void0red@hust.edu.cn, aboutphysycs@gmail.com,
	Alexandru Ardelean <alex@shruggie.ro>
Subject: [PATCH] thermal/drivers/mediatek: remove redundant dev_warn in probe
Date: Sun, 13 Aug 2023 22:08:45 +0300	[thread overview]
Message-ID: <20230813190845.49738-1-alex@shruggie.ro> (raw)

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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2023-08-13 19:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-13 19:08 Alexandru Ardelean [this message]
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  5:20   ` Chen-Yu Tsai
2023-08-14  6:16   ` Alexandru Ardelean
2023-08-14  6:16     ` Alexandru Ardelean

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=20230813190845.49738-1-alex@shruggie.ro \
    --to=alex@shruggie.ro \
    --cc=aboutphysycs@gmail.com \
    --cc=amitk@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=aouledameur@baylibre.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=daniel@makrotopia.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=void0red@hust.edu.cn \
    /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 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.