All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: dragos.bogdan@analog.com
Cc: linux-iio@vger.kernel.org
Subject: [bug report] iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R
Date: Fri, 1 May 2020 12:44:49 +0300	[thread overview]
Message-ID: <20200501094449.GA960353@mwanda> (raw)

Hello Dragos Bogdan,

The patch 3a6af93dd66e: "iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for
AD7091R" from Mar 11, 2020, leads to the following static checker
warning:

	drivers/iio/adc/ad7476.c:312 ad7476_probe()
	warn: this array is non-NULL. 'st->chip_info->convst_channel'

drivers/iio/adc/ad7476.c
   288          ret = devm_add_action_or_reset(&spi->dev, ad7476_reg_disable,
   289                                         st);
   290          if (ret)
   291                  return ret;
   292  
   293          st->convst_gpio = devm_gpiod_get_optional(&spi->dev,
   294                                                    "adi,conversion-start",
   295                                                    GPIOD_OUT_LOW);
   296          if (IS_ERR(st->convst_gpio))
   297                  return PTR_ERR(st->convst_gpio);
   298  
   299          spi_set_drvdata(spi, indio_dev);
   300  
   301          st->spi = spi;
   302  
   303          /* Establish that the iio_dev is a child of the spi device */
   304          indio_dev->dev.parent = &spi->dev;
   305          indio_dev->dev.of_node = spi->dev.of_node;
   306          indio_dev->name = spi_get_device_id(spi)->name;
   307          indio_dev->modes = INDIO_DIRECT_MODE;
   308          indio_dev->channels = st->chip_info->channel;
   309          indio_dev->num_channels = 2;
   310          indio_dev->info = &ad7476_info;
   311  
   312          if (st->convst_gpio && st->chip_info->convst_channel)
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is an array, not a pointer and it it's in the middle of the struct
so it can't possibly be NULL.

   313                  indio_dev->channels = st->chip_info->convst_channel;
   314          /* Setup default message */
   315  
   316          st->xfer.rx_buf = &st->data;
   317          st->xfer.len = st->chip_info->channel[0].scan_type.storagebits / 8;
   318  
   319          spi_message_init(&st->msg);
   320          spi_message_add_tail(&st->xfer, &st->msg);
   321  

regards,
dan carpenter

             reply	other threads:[~2020-05-01  9:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01  9:44 Dan Carpenter [this message]
2020-05-01 10:11 ` [bug report] iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R Ardelean, Alexandru

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=20200501094449.GA960353@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=dragos.bogdan@analog.com \
    --cc=linux-iio@vger.kernel.org \
    /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.