Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1274684

Re: [alsa-devel] [PATCH 1/4] sound: codecs: pcm1792a: clean function exit

From Raphaël Poggi <poggi.raph@gmail.com>
Newsgroups linux.kernel
Subject Re: [alsa-devel] [PATCH 1/4] sound: codecs: pcm1792a: clean function exit
Date 2015-11-21 17:20 +0100
Message-ID <qxj3j-7GJ-5@gated-at.bofh.it> (permalink)
References <qwQNI-5O7-5@gated-at.bofh.it> <qwQXo-5SQ-5@gated-at.bofh.it> <qxcOd-3oU-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

I know that almost all the codec do as before, but what is the goal of
using an extra condition when we can avoid it ?

Raphael

2015-11-21 10:31 GMT+01:00 Michael Trimarchi <michael@amarulasolutions.com>:
> Hi
>
> On Fri, Nov 20, 2015 at 11:09 AM, Raphael Poggi <poggi.raph@gmail.com> wrote:
>> From: Raphael Poggi <poggi.raph@gmail.com>
>>
>> Signed-off-by: Raphael Poggi <poggi.raph@gmail.com>
>> ---
>>  sound/soc/codecs/pcm1792a.c | 14 ++++----------
>>  1 file changed, 4 insertions(+), 10 deletions(-)
>>
>> diff --git a/sound/soc/codecs/pcm1792a.c b/sound/soc/codecs/pcm1792a.c
>> index 08bb486..cf42b24 100644
>> --- a/sound/soc/codecs/pcm1792a.c
>> +++ b/sound/soc/codecs/pcm1792a.c
>> @@ -91,14 +91,9 @@ static int pcm1792a_digital_mute(struct snd_soc_dai *dai, int mute)
>>  {
>>         struct snd_soc_codec *codec = dai->codec;
>>         struct pcm1792a_private *priv = snd_soc_codec_get_drvdata(codec);
>> -       int ret;
>>
>> -       ret = regmap_update_bits(priv->regmap, PCM1792A_SOFT_MUTE,
>> +       return regmap_update_bits(priv->regmap, PCM1792A_SOFT_MUTE,
>>                                  PCM1792A_MUTE_MASK, !!mute);
>> -       if (ret < 0)
>> -               return ret;
>> -
>
> Ok, I have seen that almost all the codecs use return regmap_upda...
>
>> -       return 0;
>>  }
>>
>>  static int pcm1792a_hw_params(struct snd_pcm_substream *substream,
>> @@ -107,7 +102,8 @@ static int pcm1792a_hw_params(struct snd_pcm_substream *substream,
>>  {
>>         struct snd_soc_codec *codec = dai->codec;
>>         struct pcm1792a_private *priv = snd_soc_codec_get_drvdata(codec);
>> -       int val = 0, ret;
>> +       int val = 0;
>> +       int ret = 0;
>>
>>         priv->rate = params_rate(params);
>>
>> @@ -147,10 +143,8 @@ static int pcm1792a_hw_params(struct snd_pcm_substream *substream,
>>
>>         ret = regmap_update_bits(priv->regmap, PCM1792A_FMT_CONTROL,
>>                                  PCM1792A_FMT_MASK | PCM1792A_ATLD_ENABLE, val);
>> -       if (ret < 0)
>> -               return ret;
>>
>
> Please do the same as before
>
> Michael
>
>
>> -       return 0;
>> +       return ret;
>>  }
>>
>>  static const struct snd_soc_dai_ops pcm1792a_dai_ops = {
>> --
>> 2.1.0
>>
>> _______________________________________________
>> Alsa-devel mailing list
>> Alsa-devel@alsa-project.org
>> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
>
>
> --
> | Michael Nazzareno Trimarchi                     Amarula Solutions BV |
> | COO  -  Founder                                      Cruquiuskade 47 |
> | +31(0)851119172                                 Amsterdam 1018 AM NL |
> |                  [`as] http://www.amarulasolutions.com               |
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] New feature and clean up for pcm1792a driver Raphael Poggi <poggi.raph@gmail.com> - 2015-11-20 11:10 +0100
  [PATCH 2/4] sound: codecs: pcm1792a: add define for register Raphael Poggi <poggi.raph@gmail.com> - 2015-11-20 11:10 +0100
    Re: [alsa-devel] [PATCH 2/4] sound: codecs: pcm1792a: add define for register Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-21 10:40 +0100
  [PATCH 1/4] sound: codecs: pcm1792a: clean function exit Raphael Poggi <poggi.raph@gmail.com> - 2015-11-20 11:20 +0100
    Re: [alsa-devel] [PATCH 1/4] sound: codecs: pcm1792a: clean function exit Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-21 10:40 +0100
      Re: [alsa-devel] [PATCH 1/4] sound: codecs: pcm1792a: clean function exit Raphaël Poggi <poggi.raph@gmail.com> - 2015-11-21 17:20 +0100
        Re: [alsa-devel] [PATCH 1/4] sound: codecs: pcm1792a: clean function  exit Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-21 17:40 +0100
  [PATCH 3/4] dt-bindings: sound: add binding for pcm1792a Raphael Poggi <poggi.raph@gmail.com> - 2015-11-20 11:20 +0100
    Re: [PATCH 3/4] dt-bindings: sound: add binding for pcm1792a Rob Herring <robh@kernel.org> - 2015-11-20 15:50 +0100
      Re: [alsa-devel] [PATCH 3/4] dt-bindings: sound: add binding for pcm1792a Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-20 16:10 +0100
  [PATCH 4/4] sound: codecs: pcm1792a: introduce channel side Raphael Poggi <poggi.raph@gmail.com> - 2015-11-20 11:20 +0100
    Re: [alsa-devel] [PATCH 4/4] sound: codecs: pcm1792a: introduce  channel side Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-21 10:40 +0100
      Re: [alsa-devel] [PATCH 4/4] sound: codecs: pcm1792a: introduce  channel side Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-24 09:30 +0100
        Re: [alsa-devel] [PATCH 4/4] sound: codecs: pcm1792a: introduce  channel side Raphaël Poggi <poggi.raph@gmail.com> - 2015-11-24 17:10 +0100
          Re: [alsa-devel] [PATCH 4/4] sound: codecs: pcm1792a: introduce  channel side Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-24 21:20 +0100
      Re: [alsa-devel] [PATCH 4/4] sound: codecs: pcm1792a: introduce  channel side Raphaël Poggi <poggi.raph@gmail.com> - 2015-11-24 09:30 +0100

csiph-web