Linux IIO development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: miquel.raynal@bootlin.com
Cc: linux-iio@vger.kernel.org
Subject: [bug report] iio: adc: max1027: Use the EOC IRQ when populated for single reads
Date: Mon, 4 Oct 2021 13:17:01 +0300	[thread overview]
Message-ID: <20211004101701.GA22161@kili> (raw)

Hello Miquel Raynal,

The patch 54f14be01e17: "iio: adc: max1027: Use the EOC IRQ when
populated for single reads" from Sep 21, 2021, leads to the following
Smatch static checker warning:

	drivers/iio/adc/max1027.c:289 max1027_wait_eoc()
	info: return a literal instead of 'ret'

drivers/iio/adc/max1027.c
    278 static int max1027_wait_eoc(struct iio_dev *indio_dev)
    279 {
    280         struct max1027_state *st = iio_priv(indio_dev);
    281         unsigned int conversion_time = MAX1027_CONVERSION_UDELAY;
    282         int ret;
    283 
    284         if (st->spi->irq) {
    285                 ret = wait_for_completion_timeout(&st->complete,
    286                                                   msecs_to_jiffies(1000));
    287                 reinit_completion(&st->complete);
    288                 if (!ret)
--> 289                         return ret;

wait_for_completion_timeout() returns zero if it times out.  Should this
be return an error code?  Otherwise we could just delete the "ret"
variable and return 0 below.

    290         } else {
    291                 if (indio_dev->active_scan_mask)
    292                         conversion_time *= hweight32(*indio_dev->active_scan_mask);
    293 
    294                 usleep_range(conversion_time, conversion_time * 2);
    295         }
    296 
    297         return 0;
    298 }

regards,
dan carpenter

             reply	other threads:[~2021-10-04 10:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04 10:17 Dan Carpenter [this message]
2021-10-04 10:35 ` [bug report] iio: adc: max1027: Use the EOC IRQ when populated for single reads Miquel Raynal

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=20211004101701.GA22161@kili \
    --to=dan.carpenter@oracle.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox