mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hwmon: (pwm-fan) Add missing check for device_property_read_u32_array
@ 2026-01-28  7:26 Chen Ni
  2026-01-28 10:23 ` Markus Elfring
  2026-01-29 14:18 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Chen Ni @ 2026-01-28  7:26 UTC (permalink / raw)
  To: linux; +Cc: linux-hwmon, linux-kernel, Chen Ni

Add check for the return value of device_property_read_u32_array() and
return the error if it fails in order to catch the error.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/hwmon/pwm-fan.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index 37269db2de84..3535007f5c37 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -609,8 +609,11 @@ static int pwm_fan_probe(struct platform_device *pdev)
 		for (i = 0; i < ctx->tach_count; i++)
 			ctx->pulses_per_revolution[i] = 2;
 
-		device_property_read_u32_array(dev, "pulses-per-revolution",
-					       ctx->pulses_per_revolution, ctx->tach_count);
+		ret = device_property_read_u32_array(dev, "pulses-per-revolution",
+						     ctx->pulses_per_revolution, ctx->tach_count);
+		if (ret)
+			return dev_err_probe(dev, ret,
+					     "Failed to read pulses-per-revolution\n");
 	}
 
 	channels = devm_kcalloc(dev, channel_count + 1,
-- 
2.25.1


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

end of thread, other threads:[~2026-01-29 14:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-28  7:26 [PATCH] hwmon: (pwm-fan) Add missing check for device_property_read_u32_array Chen Ni
2026-01-28 10:23 ` Markus Elfring
2026-01-29 14:18 ` 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®