linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal/of: fix error code in of_thermal_zone_find()
@ 2022-08-08 11:29 Dan Carpenter
  2022-08-23 12:43 ` [thermal: thermal/next] thermal/of: Fix " thermal-bot for Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-08-08 11:29 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano
  Cc: Amit Kucheria, Zhang Rui, linux-pm, kernel-janitors

Currently, if we cannot find the correct thermal zone then this error
path returns NULL and it would lead to an Oops in the caller.  Return
ERR_PTR(-EINVAL) instead.

Fixes: 3bd52ac87347 ("thermal/of: Rework the thermal device tree initialization")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I don't know if this error path is really possible.  It's from static
analysis.

 drivers/thermal/thermal_of.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index c2bb5954b21e..368eb58e97cf 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -368,6 +368,7 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int
 			}
 		}
 	}
+	tz = ERR_PTR(-EINVAL);
 out:
 	of_node_put(np);
 	return tz;
-- 
2.35.1


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

* [thermal: thermal/next] thermal/of: Fix error code in of_thermal_zone_find()
  2022-08-08 11:29 [PATCH] thermal/of: fix error code in of_thermal_zone_find() Dan Carpenter
@ 2022-08-23 12:43 ` thermal-bot for Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: thermal-bot for Dan Carpenter @ 2022-08-23 12:43 UTC (permalink / raw)
  To: linux-pm; +Cc: Dan Carpenter, Daniel Lezcano, rui.zhang, amitk

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     45b8850b3d3071d5ea9e19ad4a29ad5f0b5d1ec1
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//45b8850b3d3071d5ea9e19ad4a29ad5f0b5d1ec1
Author:        Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate:    Tue, 09 Aug 2022 10:56:26 +02:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Wed, 17 Aug 2022 14:09:37 +02:00

thermal/of: Fix error code in of_thermal_zone_find()

Currently, if we cannot find the correct thermal zone then this error
path returns NULL and it would lead to an Oops in the caller.  Return
ERR_PTR(-EINVAL) instead.

Fixes: 3bd52ac87347 ("thermal/of: Rework the thermal device tree initialization")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YvDzovkMCQecPDjz@kili
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/thermal_of.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index 82236fe..15b342f 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -1102,6 +1102,7 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int 
 			}
 		}
 	}
+	tz = ERR_PTR(-EINVAL);
 out:
 	of_node_put(np);
 	return tz;

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

end of thread, other threads:[~2022-08-23 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-08 11:29 [PATCH] thermal/of: fix error code in of_thermal_zone_find() Dan Carpenter
2022-08-23 12:43 ` [thermal: thermal/next] thermal/of: Fix " thermal-bot for Dan Carpenter

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).