]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gpio: tps65912: check the return value of regmap_update_bits()
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 7 Jul 2025 07:50:15 +0000 (09:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:22:40 +0000 (16:22 +0200)
[ Upstream commit a0b2a6bbff8c26aafdecd320f38f52c341d5cafa ]

regmap_update_bits() can fail, check its return value like we do
elsewhere in the driver.

Link: https://lore.kernel.org/r/20250707-gpiochip-set-rv-gpio-round4-v1-2-35668aaaf6d2@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpio-tps65912.c

index 510d9ed9fd2a358af99ac5d7e58cf0d39c2b3cd8..a8a2ad13e09e08b9e9c46481f12b7876f0f9417a 100644 (file)
@@ -49,10 +49,13 @@ static int tps65912_gpio_direction_output(struct gpio_chip *gc,
                                          unsigned offset, int value)
 {
        struct tps65912_gpio *gpio = gpiochip_get_data(gc);
+       int ret;
 
        /* Set the initial value */
-       regmap_update_bits(gpio->tps->regmap, TPS65912_GPIO1 + offset,
-                          GPIO_SET_MASK, value ? GPIO_SET_MASK : 0);
+       ret = regmap_update_bits(gpio->tps->regmap, TPS65912_GPIO1 + offset,
+                                GPIO_SET_MASK, value ? GPIO_SET_MASK : 0);
+       if (ret)
+               return ret;
 
        return regmap_update_bits(gpio->tps->regmap, TPS65912_GPIO1 + offset,
                                  GPIO_CFG_MASK, GPIO_CFG_MASK);