linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: mediatek-hw: don't use error path on NULL fdvfs
@ 2025-08-19 11:21 Nicolas Frattaroli
  2025-08-20  4:07 ` Viresh Kumar
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Frattaroli @ 2025-08-19 11:21 UTC (permalink / raw)
  To: Dan Carpenter, Rafael J. Wysocki, Viresh Kumar, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: kernel, AngeloGioacchino Del Regno, linux-pm, linux-kernel,
	linux-arm-kernel, linux-mediatek, Nicolas Frattaroli

The IS_ERR_OR_NULL check for priv->fdvfs is inappropriate, and should be
an IS_ERR check instead, as a NULL value here would propagate it to
PTR_ERR.

In practice, there is no problem here, as devm_of_iomap cannot return
NULL in any circumstance. However, it causes a Smatch static checker
warning.

Fix the warning by changing the check from IS_ERR_OR_NULL to IS_ERR.

Fixes: 32e0d669f3ac ("cpufreq: mediatek-hw: Add support for MT8196")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-pm/aKQubSEXH1TXQpnR@stanley.mountain/
Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
---
 drivers/cpufreq/mediatek-cpufreq-hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/mediatek-cpufreq-hw.c b/drivers/cpufreq/mediatek-cpufreq-hw.c
index e4eadce6f937ceff51b34d22da83c51b4e9aa813..fce5aa5ceea033bb70537ad9280e9ee02e3671cc 100644
--- a/drivers/cpufreq/mediatek-cpufreq-hw.c
+++ b/drivers/cpufreq/mediatek-cpufreq-hw.c
@@ -72,7 +72,7 @@ static const struct mtk_cpufreq_variant cpufreq_mtk_base_variant = {
 static int mtk_cpufreq_hw_mt8196_init(struct mtk_cpufreq_priv *priv)
 {
 	priv->fdvfs = devm_of_iomap(priv->dev, priv->dev->of_node, 0, NULL);
-	if (IS_ERR_OR_NULL(priv->fdvfs))
+	if (IS_ERR(priv->fdvfs))
 		return dev_err_probe(priv->dev, PTR_ERR(priv->fdvfs),
 				     "failed to get fdvfs iomem\n");
 

---
base-commit: 73df59e80dc7cab098b4581b89459d18f8410c7d
change-id: 20250819-mt8196-cpufreq-fix-07557cca2ef1

Best regards,
-- 
Nicolas Frattaroli <nicolas.frattaroli@collabora.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cpufreq: mediatek-hw: don't use error path on NULL fdvfs
  2025-08-19 11:21 [PATCH] cpufreq: mediatek-hw: don't use error path on NULL fdvfs Nicolas Frattaroli
@ 2025-08-20  4:07 ` Viresh Kumar
  0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2025-08-20  4:07 UTC (permalink / raw)
  To: Nicolas Frattaroli
  Cc: Dan Carpenter, Rafael J. Wysocki, Matthias Brugger,
	AngeloGioacchino Del Regno, kernel, AngeloGioacchino Del Regno,
	linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek

On 19-08-25, 13:21, Nicolas Frattaroli wrote:
> The IS_ERR_OR_NULL check for priv->fdvfs is inappropriate, and should be
> an IS_ERR check instead, as a NULL value here would propagate it to
> PTR_ERR.
> 
> In practice, there is no problem here, as devm_of_iomap cannot return
> NULL in any circumstance. However, it causes a Smatch static checker
> warning.
> 
> Fix the warning by changing the check from IS_ERR_OR_NULL to IS_ERR.
> 
> Fixes: 32e0d669f3ac ("cpufreq: mediatek-hw: Add support for MT8196")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/linux-pm/aKQubSEXH1TXQpnR@stanley.mountain/
> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> ---
>  drivers/cpufreq/mediatek-cpufreq-hw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied. Thanks.

-- 
viresh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-20  4:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19 11:21 [PATCH] cpufreq: mediatek-hw: don't use error path on NULL fdvfs Nicolas Frattaroli
2025-08-20  4:07 ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).