]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/gpio/gpio-max732x.c
gpio: max732x: Be sure to clamp return value
[karo-tx-linux.git] / drivers / gpio / gpio-max732x.c
index a1094984b666c068fd80f4aa2e038549f7b36d25..880ce94e607782f80f8f0c74f5f4b165e3cb6755 100644 (file)
@@ -207,9 +207,9 @@ static int max732x_gpio_get_value(struct gpio_chip *gc, unsigned off)
 
        ret = max732x_readb(chip, is_group_a(chip, off), &reg_val);
        if (ret < 0)
-               return 0;
+               return ret;
 
-       return reg_val & (1u << (off & 0x7));
+       return !!(reg_val & (1u << (off & 0x7)));
 }
 
 static void max732x_gpio_set_mask(struct gpio_chip *gc, unsigned off, int mask,