From: Peter Ujfalusi Date: Tue, 4 Oct 2011 11:39:42 +0000 (+0300) Subject: ASoC: twl6040: Simplify custom put_volsw callback X-Git-Tag: v3.3-rc1~14^2~570 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bfd3d4e9fbb9705181b821b478cc044911e47320;p=profile%2Fivi%2Fkernel-x86-ivi.git ASoC: twl6040: Simplify custom put_volsw callback 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 Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index d040905..8c740c1 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c @@ -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)