leds: lp5521: Add an error check in lp5521_post_init_device
authorSu Hui <suhui@nfschina.com>
Fri, 20 Oct 2023 09:19:31 +0000 (17:19 +0800)
committerLee Jones <lee@kernel.org>
Wed, 1 Nov 2023 11:29:26 +0000 (11:29 +0000)
lp55xx_write() can return an error code, add a check for this.

Signed-off-by: Su Hui <suhui@nfschina.com>
Link: https://lore.kernel.org/r/20231020091930.207870-1-suhui@nfschina.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/leds-lp5521.c

index 2ef19ad23b1d5f5f7d4bb4022cac625c98bcd270..f9c8b568b6525416b8d806835e045d6a99b0da9d 100644 (file)
@@ -301,6 +301,8 @@ static int lp5521_post_init_device(struct lp55xx_chip *chip)
 
        /* Set all PWMs to direct control mode */
        ret = lp55xx_write(chip, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT);
+       if (ret)
+               return ret;
 
        /* Update configuration for the clock setting */
        val = LP5521_DEFAULT_CFG;