[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240725081537.3247339-1-nichen@iscas.ac.cn>
Date: Thu, 25 Jul 2024 16:15:37 +0800
From: Chen Ni <nichen@...as.ac.cn>
To: pavel@....cz,
lee@...nel.org,
kabel@...nel.org
Cc: linux-leds@...r.kernel.org,
linux-kernel@...r.kernel.org,
Chen Ni <nichen@...as.ac.cn>
Subject: [PATCH] leds: ns2: add missing check for fwnode_property_read_u32_array
Add check for the return value of fwnode_property_read_u32_array() and
return the error if it fails in order to catch the error.
Fixes: 940cca1ab5d6 ("leds: ns2: convert to fwnode API")
Signed-off-by: Chen Ni <nichen@...as.ac.cn>
---
drivers/leds/leds-ns2.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c
index f3010c472bbd..0713f7e9d1af 100644
--- a/drivers/leds/leds-ns2.c
+++ b/drivers/leds/leds-ns2.c
@@ -202,8 +202,12 @@ static int ns2_led_register(struct device *dev, struct fwnode_handle *node,
if (!modval)
return -ENOMEM;
- fwnode_property_read_u32_array(node, "modes-map", (void *)modval,
- nmodes * 3);
+ ret = fwnode_property_read_u32_array(node, "modes-map", (void *)modval,
+ nmodes * 3);
+ if (ret) {
+ dev_err(dev, "Missing modes-map property for %pfw\n", node);
+ return ret;
+ }
rwlock_init(&led->rw_lock);
--
2.25.1
Powered by blists - more mailing lists