ASoC: twl6040: Simplify custom put_volsw callback
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Tue, 4 Oct 2011 11:39:42 +0000 (14:39 +0300)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 4 Oct 2011 15:28:29 +0000 (16:28 +0100)
Return -EINVAL in the unlikely event, if the function has been called
for unhandled control. This way we can remove one check in the code.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/twl6040.c

index d040905cfa9ba69df7fb08fa2f9082f59ca1a9a2..8c740c1aa32f738d06f096c9dc6149752ca932a8 100644 (file)
@@ -759,15 +759,13 @@ static int twl6040_put_volsw(struct snd_kcontrol *kcontrol,
                out = &twl6040_priv->handsfree;
                break;
        default:
-               break;
+               return -EINVAL;
        }
 
-       if (out) {
-               out->left_vol = ucontrol->value.integer.value[0];
-               out->right_vol = ucontrol->value.integer.value[1];
-               if (!out->active)
-                       return 1;
-       }
+       out->left_vol = ucontrol->value.integer.value[0];
+       out->right_vol = ucontrol->value.integer.value[1];
+       if (!out->active)
+               return 1;
 
        /* call the appropriate handler depending on the rreg */
        if (mc->rreg)