mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hwmon: (tmp513) Add missing check for device_property_read_u32_array
@ 2026-01-28  7:30 Chen Ni
  2026-01-28 10:28 ` Markus Elfring
  2026-01-29 14:20 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Chen Ni @ 2026-01-28  7:30 UTC (permalink / raw)
  To: etremblay, 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/tmp513.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/tmp513.c b/drivers/hwmon/tmp513.c
index 5acbfd7d088d..f201d0a9ba14 100644
--- a/drivers/hwmon/tmp513.c
+++ b/drivers/hwmon/tmp513.c
@@ -676,8 +676,10 @@ static int tmp51x_read_properties(struct device *dev, struct tmp51x_data *data)
 	if (ret < 0)
 		return ret;
 
-	device_property_read_u32_array(dev, "ti,nfactor", data->nfactor,
-				       data->max_channels - 1);
+	ret = device_property_read_u32_array(dev, "ti,nfactor", data->nfactor,
+					     data->max_channels - 1);
+	if (ret)
+		return ret;
 
 	// Check if shunt value is compatible with pga-gain
 	if (data->shunt_uohms > data->pga_gain * 40 * MICRO) {
-- 
2.25.1


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

end of thread, other threads:[~2026-01-29 14:20 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:30 [PATCH] hwmon: (tmp513) Add missing check for device_property_read_u32_array Chen Ni
2026-01-28 10:28 ` Markus Elfring
2026-01-29 14:20 ` 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®