mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hwmon: gpd-fan: Fix return value when platform_get_resource() fails
@ 2025-10-10 20:43 Harshit Mogalapalli
  2025-10-11  6:12 ` Cryolitia PukNgae
  2025-10-12 17:50 ` Guenter Roeck
  0 siblings, 2 replies; 4+ messages in thread
From: Harshit Mogalapalli @ 2025-10-10 20:43 UTC (permalink / raw)
  To: Cryolitia PukNgae, Guenter Roeck, linux-hwmon, linux-kernel
  Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli

When platform_get_resource() fails it returns NULL and not an error
pointer, accordingly change the error handling.

Fixes: 0ab88e239439 ("hwmon: add GPD devices sensor driver")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is based on static analysis with Smatch, only compile tested.
---
 drivers/hwmon/gpd-fan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/gpd-fan.c b/drivers/hwmon/gpd-fan.c
index 644dc3ca9df7..eebe39ef9677 100644
--- a/drivers/hwmon/gpd-fan.c
+++ b/drivers/hwmon/gpd-fan.c
@@ -615,8 +615,8 @@ static int gpd_fan_probe(struct platform_device *pdev)
 	const struct device *hwdev;
 
 	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
-	if (IS_ERR(res))
-		return dev_err_probe(dev, PTR_ERR(res),
+	if (!res)
+		return dev_err_probe(dev, -EINVAL,
 				     "Failed to get platform resource\n");
 
 	region = devm_request_region(dev, res->start,
-- 
2.39.3


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

end of thread, other threads:[~2025-10-12 17:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-10 20:43 [PATCH] hwmon: gpd-fan: Fix return value when platform_get_resource() fails Harshit Mogalapalli
2025-10-11  6:12 ` Cryolitia PukNgae
2025-10-11 17:27   ` Harshit Mogalapalli
2025-10-12 17:50 ` Guenter Roeck

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®