All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: ASoC: ssm4567: Add driver for Analog Devices SSM4567 amplifier
@ 2014-10-01 17:02 Dan Carpenter
  2014-10-01 17:12 ` Anatol Pomozov
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2014-10-01 17:02 UTC (permalink / raw)
  To: anatol.pomozov; +Cc: alsa-devel

Hello Anatol Pomozov,

The patch 1ee44ce03011: "ASoC: ssm4567: Add driver for Analog Devices
SSM4567 amplifier" from Sep 26, 2014, leads to the following static
checker warning:

	sound/soc/codecs/ssm4567.c:176 ssm4567_hw_params()
	warn: we tested 'rate <= 96000' before and it was 'false'

sound/soc/codecs/ssm4567.c
   160  static int ssm4567_hw_params(struct snd_pcm_substream *substream,
   161          struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
   162  {
   163          struct snd_soc_codec *codec = dai->codec;
   164          struct ssm4567 *ssm4567 = snd_soc_codec_get_drvdata(codec);
   165          unsigned int rate = params_rate(params);
   166          unsigned int dacfs;
   167  
   168          if (rate >= 8000 && rate <= 12000)
   169                  dacfs = SSM4567_DAC_FS_8000_12000;
   170          else if (rate >= 16000 && rate <= 24000)
   171                  dacfs = SSM4567_DAC_FS_16000_24000;
   172          else if (rate >= 32000 && rate <= 48000)
   173                  dacfs = SSM4567_DAC_FS_32000_48000;
   174          else if (rate >= 64000 && rate <= 96000)
   175                  dacfs = SSM4567_DAC_FS_64000_96000;
   176          else if (rate >= 64000 && rate <= 96000)
   177                  dacfs = SSM4567_DAC_FS_64000_96000;

These two lines are a cut and paste error.  The intent is not clear.

   178          else if (rate >= 128000 && rate <= 192000)
   179                  dacfs = SSM4567_DAC_FS_128000_192000;
   180          else
   181                  return -EINVAL;
   182  
   183          return regmap_update_bits(ssm4567->regmap, SSM4567_REG_DAC_CTRL,
   184                                  SSM4567_DAC_FS_MASK, dacfs);
   185  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ASoC: ssm4567: Add driver for Analog Devices SSM4567 amplifier
  2014-10-01 17:02 ASoC: ssm4567: Add driver for Analog Devices SSM4567 amplifier Dan Carpenter
@ 2014-10-01 17:12 ` Anatol Pomozov
  2014-10-01 17:44   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Anatol Pomozov @ 2014-10-01 17:12 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: alsa-devel

Hi

On Wed, Oct 1, 2014 at 10:02 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> Hello Anatol Pomozov,
>
> The patch 1ee44ce03011: "ASoC: ssm4567: Add driver for Analog Devices
> SSM4567 amplifier" from Sep 26, 2014, leads to the following static
> checker warning:

Thanks!

What static checker do you use and how can I run locally?

>         sound/soc/codecs/ssm4567.c:176 ssm4567_hw_params()
>         warn: we tested 'rate <= 96000' before and it was 'false'
>
> sound/soc/codecs/ssm4567.c
>    160  static int ssm4567_hw_params(struct snd_pcm_substream *substream,
>    161          struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
>    162  {
>    163          struct snd_soc_codec *codec = dai->codec;
>    164          struct ssm4567 *ssm4567 = snd_soc_codec_get_drvdata(codec);
>    165          unsigned int rate = params_rate(params);
>    166          unsigned int dacfs;
>    167
>    168          if (rate >= 8000 && rate <= 12000)
>    169                  dacfs = SSM4567_DAC_FS_8000_12000;
>    170          else if (rate >= 16000 && rate <= 24000)
>    171                  dacfs = SSM4567_DAC_FS_16000_24000;
>    172          else if (rate >= 32000 && rate <= 48000)
>    173                  dacfs = SSM4567_DAC_FS_32000_48000;
>    174          else if (rate >= 64000 && rate <= 96000)
>    175                  dacfs = SSM4567_DAC_FS_64000_96000;
>    176          else if (rate >= 64000 && rate <= 96000)
>    177                  dacfs = SSM4567_DAC_FS_64000_96000;
>
> These two lines are a cut and paste error.  The intent is not clear.

It is a copy/paste error. Will send a fix soon.

>
>    178          else if (rate >= 128000 && rate <= 192000)
>    179                  dacfs = SSM4567_DAC_FS_128000_192000;
>    180          else
>    181                  return -EINVAL;
>    182
>    183          return regmap_update_bits(ssm4567->regmap, SSM4567_REG_DAC_CTRL,
>    184                                  SSM4567_DAC_FS_MASK, dacfs);
>    185  }
>
> regards,
> dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ASoC: ssm4567: Add driver for Analog Devices SSM4567 amplifier
  2014-10-01 17:12 ` Anatol Pomozov
@ 2014-10-01 17:44   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-10-01 17:44 UTC (permalink / raw)
  To: Anatol Pomozov; +Cc: alsa-devel

On Wed, Oct 01, 2014 at 10:12:53AM -0700, Anatol Pomozov wrote:
> Hi
> 
> On Wed, Oct 1, 2014 at 10:02 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > Hello Anatol Pomozov,
> >
> > The patch 1ee44ce03011: "ASoC: ssm4567: Add driver for Analog Devices
> > SSM4567 amplifier" from Sep 26, 2014, leads to the following static
> > checker warning:
> 
> Thanks!
> 
> What static checker do you use and how can I run locally?

This is a smatch warning, but you have to run with the --spammy option
to see it because these warnings are often false postives.

~/progs/smatch/devel/smatch_scripts/kchecker --spammy sound/soc/codecs/ssm4567.c

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-01 17:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-01 17:02 ASoC: ssm4567: Add driver for Analog Devices SSM4567 amplifier Dan Carpenter
2014-10-01 17:12 ` Anatol Pomozov
2014-10-01 17:44   ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.