[PATCH] hwmon: (pwm-fan) Add missing check for device_property_read_u32_array
From: Chen Ni
Date: Wed Jan 28 2026 - 02:26:40 EST
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@xxxxxxxxxxx>
---
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