From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-iio@vger.kernel.org, Jonathan Cameron <jic23@kernel.org>
Subject: Re: [bug report] iio: adc: max1027: Use the EOC IRQ when populated for single reads
Date: Mon, 4 Oct 2021 12:35:56 +0200 [thread overview]
Message-ID: <20211004123556.38a1e1b3@xps13> (raw)
In-Reply-To: <20211004101701.GA22161@kili>
Hi Jonathan,
dan.carpenter@oracle.com wrote on Mon, 4 Oct 2021 13:17:01 +0300:
> 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.
I received this bug report, indeed this should use
if (!ret)
return -ETIMEDOUT;
Can you fix it directly? Do you want a fixup! patch to apply and
squash? Or a perhaps a regular patch?
>
> 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
Thanks,
Miquèl
prev parent reply other threads:[~2021-10-04 10:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-04 10:17 [bug report] iio: adc: max1027: Use the EOC IRQ when populated for single reads Dan Carpenter
2021-10-04 10:35 ` Miquel Raynal [this message]
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=20211004123556.38a1e1b3@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=dan.carpenter@oracle.com \
--cc=jic23@kernel.org \
--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.