All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: arnaud.pouliquen@st.com
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Arnaud Pouliquen <arnaud.pouliquen@st.com>,
	linux-iio@vger.kernel.org
Subject: [bug report] IIO: ADC: add stm32 DFSDM support for PDM microphone
Date: Tue, 16 Jan 2018 14:43:01 +0300	[thread overview]
Message-ID: <20180116114301.GA9506@mwanda> (raw)

Hello Arnaud Pouliquen,

The patch eca949800d2d: "IIO: ADC: add stm32 DFSDM support for PDM
microphone" from Jan 10, 2018, leads to the following static checker
warning:

	drivers/iio/adc/stm32-dfsdm-adc.c:555 stm32_dfsdm_audio_dma_buffer_done()
	warn: potential shift truncation.  '0xffffff00 (0,256-4294967040) << 8'

drivers/iio/adc/stm32-dfsdm-adc.c
   551          while (available >= indio_dev->scan_bytes) {
   552                  u32 *buffer = (u32 *)&adc->rx_buf[adc->bufi];
   553  
   554                  /* Mask 8 LSB that contains the channel ID */
   555                  *buffer = (*buffer & 0xFFFFFF00) << 8;

Is this shift, correct?  The comment just mentions that we're masking
out the low bits.

   556                  available -= indio_dev->scan_bytes;
   557                  adc->bufi += indio_dev->scan_bytes;
   558                  if (adc->bufi >= adc->buf_sz) {
   559                          if (adc->cb)
   560                                  adc->cb(&adc->rx_buf[old_pos],
   561                                           adc->buf_sz - old_pos, adc->cb_priv);
   562                          adc->bufi = 0;
   563                          old_pos = 0;
   564                  }
   565          }
   566          if (adc->cb)
   567                  adc->cb(&adc->rx_buf[old_pos], adc->bufi - old_pos,
   568                          adc->cb_priv);
   569  }

regards,
dan carpenter

             reply	other threads:[~2018-01-16 11:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 11:43 Dan Carpenter [this message]
2018-01-16 12:47 ` [bug report] IIO: ADC: add stm32 DFSDM support for PDM microphone Arnaud Pouliquen
2018-01-16 12:50   ` Dan Carpenter
2018-01-16 13:03     ` Arnaud Pouliquen
2018-01-16 13:08       ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180116114301.GA9506@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=arnaud.pouliquen@st.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.