[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260128072610.2476625-1-nichen@iscas.ac.cn>
Date: Wed, 28 Jan 2026 15:26:10 +0800
From: Chen Ni <nichen@...as.ac.cn>
To: linux@...ck-us.net
Cc: linux-hwmon@...r.kernel.org,
linux-kernel@...r.kernel.org,
Chen Ni <nichen@...as.ac.cn>
Subject: [PATCH] hwmon: (pwm-fan) Add missing check for device_property_read_u32_array
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@...as.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
Powered by blists - more mailing lists