summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuanjun Gong <ruc_gongyuanjun@163.com>2025-02-23 20:14:59 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-05-29 11:02:36 +0200
commit562b4f70bf88add47ef146e02bf972b9a8ab370d (patch)
treedf43792722eb9d6d01437774b114600766caa68d
parentb8fcb1cdbfc0c876a443d34ae3fe5154d6642715 (diff)
leds: pwm-multicolor: Add check for fwnode_property_read_u32
[ Upstream commit 6d91124e7edc109f114b1afe6d00d85d0d0ac174 ] Add a check to the return value of fwnode_property_read_u32() in case it fails. Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com> Link: https://lore.kernel.org/r/20250223121459.2889484-1-ruc_gongyuanjun@163.com Signed-off-by: Lee Jones <lee@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/leds/rgb/leds-pwm-multicolor.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/leds/rgb/leds-pwm-multicolor.c b/drivers/leds/rgb/leds-pwm-multicolor.c
index e1a81e0109e8..c0aa34b1d0e2 100644
--- a/drivers/leds/rgb/leds-pwm-multicolor.c
+++ b/drivers/leds/rgb/leds-pwm-multicolor.c
@@ -135,8 +135,11 @@ static int led_pwm_mc_probe(struct platform_device *pdev)
/* init the multicolor's LED class device */
cdev = &priv->mc_cdev.led_cdev;
- fwnode_property_read_u32(mcnode, "max-brightness",
+ ret = fwnode_property_read_u32(mcnode, "max-brightness",
&cdev->max_brightness);
+ if (ret)
+ goto release_mcnode;
+
cdev->flags = LED_CORE_SUSPENDRESUME;
cdev->brightness_set_blocking = led_pwm_mc_set;