]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: Fix return value of wm8962_gpio_direction_out()
authorAxel Lin <axel.lin@gmail.com>
Fri, 30 Dec 2011 15:38:03 +0000 (23:38 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 2 Jan 2012 13:08:34 +0000 (13:08 +0000)
We can't just pass back the return value of snd_soc_update_bits() as it
will be 1 if a bit changed rather than zero.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/wm8962.c

index 1be4eb36412899a17948635747852b0b81f5df13..296de4e30d26f49729cd25bc4c22134b01fb90aa 100644 (file)
@@ -3878,13 +3878,17 @@ static int wm8962_gpio_direction_out(struct gpio_chip *chip,
 {
        struct wm8962_priv *wm8962 = gpio_to_wm8962(chip);
        struct snd_soc_codec *codec = wm8962->codec;
-       int val;
+       int ret, val;
 
        /* Force function 1 (logic output) */
        val = (1 << WM8962_GP2_FN_SHIFT) | (value << WM8962_GP2_LVL_SHIFT);
 
-       return snd_soc_update_bits(codec, WM8962_GPIO_BASE + offset,
-                                  WM8962_GP2_FN_MASK | WM8962_GP2_LVL, val);
+       ret = snd_soc_update_bits(codec, WM8962_GPIO_BASE + offset,
+                                 WM8962_GP2_FN_MASK | WM8962_GP2_LVL, val);
+       if (ret < 0)
+               return ret;
+
+       return 0;
 }
 
 static struct gpio_chip wm8962_template_chip = {