]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
leds: pwm-multicolor: Add check for fwnode_property_read_u32
authorYuanjun Gong <ruc_gongyuanjun@163.com>
Sun, 23 Feb 2025 12:14:59 +0000 (20:14 +0800)
committerLee Jones <lee@kernel.org>
Thu, 27 Feb 2025 17:47:50 +0000 (17:47 +0000)
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>
drivers/leds/rgb/leds-pwm-multicolor.c

index f80a06cc31f8a4fca0ac6d42d69181ceb4624e04..1c7705bafdfc753523466d26448b6728618ddcd3 100644 (file)
@@ -141,8 +141,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;