* [PATCH] iio: adc: tsc2046: fix a warning message in tsc2046_adc_update_scan_mode()
@ 2021-05-15 9:51 Dan Carpenter
2021-05-16 9:51 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-05-15 9:51 UTC (permalink / raw)
To: Oleksij Rempel
Cc: kernel, Jonathan Cameron, Lars-Peter Clausen, Andy Shevchenko,
linux-iio, kernel-janitors
These variables are unsigned so the condition can't be less than zero
and the warning message will never be printed.
Fixes: 5fec3541aa88 ("iio: adc: add ADC driver for the TI TSC2046 controller")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/iio/adc/ti-tsc2046.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ti-tsc2046.c b/drivers/iio/adc/ti-tsc2046.c
index 89a818b653b4..cf5373d5cdd7 100644
--- a/drivers/iio/adc/ti-tsc2046.c
+++ b/drivers/iio/adc/ti-tsc2046.c
@@ -398,7 +398,7 @@ static int tsc2046_adc_update_scan_mode(struct iio_dev *indio_dev,
priv->xfer.len = size;
priv->time_per_scan_us = size * 8 * priv->time_per_bit_ns / NSEC_PER_USEC;
- if ((priv->scan_interval_us - priv->time_per_scan_us) < 0)
+ if (priv->scan_interval_us > priv->time_per_scan_us)
dev_warn(&priv->spi->dev, "The scan interval (%d) is less then calculated scan time (%d)\n",
priv->scan_interval_us, priv->time_per_scan_us);
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: adc: tsc2046: fix a warning message in tsc2046_adc_update_scan_mode()
2021-05-15 9:51 [PATCH] iio: adc: tsc2046: fix a warning message in tsc2046_adc_update_scan_mode() Dan Carpenter
@ 2021-05-16 9:51 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2021-05-16 9:51 UTC (permalink / raw)
To: Dan Carpenter
Cc: Oleksij Rempel, kernel, Lars-Peter Clausen, Andy Shevchenko,
linux-iio, kernel-janitors
On Sat, 15 May 2021 12:51:52 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> These variables are unsigned so the condition can't be less than zero
> and the warning message will never be printed.
>
> Fixes: 5fec3541aa88 ("iio: adc: add ADC driver for the TI TSC2046 controller")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied. Thanks.
Chances are I'm going to rebase togreg shortly to unwind a merge conflict
with fixes-togreg so hopefully I'll manage to remember to update that fixes
tag.
Thanks,
Jonathan
> ---
> drivers/iio/adc/ti-tsc2046.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ti-tsc2046.c b/drivers/iio/adc/ti-tsc2046.c
> index 89a818b653b4..cf5373d5cdd7 100644
> --- a/drivers/iio/adc/ti-tsc2046.c
> +++ b/drivers/iio/adc/ti-tsc2046.c
> @@ -398,7 +398,7 @@ static int tsc2046_adc_update_scan_mode(struct iio_dev *indio_dev,
> priv->xfer.len = size;
> priv->time_per_scan_us = size * 8 * priv->time_per_bit_ns / NSEC_PER_USEC;
>
> - if ((priv->scan_interval_us - priv->time_per_scan_us) < 0)
> + if (priv->scan_interval_us > priv->time_per_scan_us)
> dev_warn(&priv->spi->dev, "The scan interval (%d) is less then calculated scan time (%d)\n",
> priv->scan_interval_us, priv->time_per_scan_us);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-16 9:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-15 9:51 [PATCH] iio: adc: tsc2046: fix a warning message in tsc2046_adc_update_scan_mode() Dan Carpenter
2021-05-16 9:51 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox