linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: inkern: fix iio_convert_raw_to_processed_unlocked
@ 2013-07-01 16:40 Alexandre Belloni
  2013-07-01 22:20 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2013-07-01 16:40 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Maxime Ripard, Thomas Petazzoni, Gregory Clement, linux-iio,
	linux-kernel, Lars-Peter Clausen, Alexandre Belloni, stable

When reading IIO_CHAN_INFO_OFFSET, the return value of iio_channel_read() for
success will be IIO_VAL*, checking for 0 is not correct.

Cc: <stable@vger.kernel.org> # 3.10.x
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 drivers/iio/inkern.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 98ddc32..0cf5f8e 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -451,7 +451,7 @@ static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan,
 	int ret;
 
 	ret = iio_channel_read(chan, &offset, NULL, IIO_CHAN_INFO_OFFSET);
-	if (ret == 0)
+	if (ret >= 0)
 		raw64 += offset;
 
 	scale_type = iio_channel_read(chan, &scale_val, &scale_val2,
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: inkern: fix iio_convert_raw_to_processed_unlocked
  2013-07-01 16:40 [PATCH] iio: inkern: fix iio_convert_raw_to_processed_unlocked Alexandre Belloni
@ 2013-07-01 22:20 ` Andrew Morton
  2013-07-03 19:42   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2013-07-01 22:20 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Jonathan Cameron, Maxime Ripard, Thomas Petazzoni,
	Gregory Clement, linux-iio, linux-kernel, Lars-Peter Clausen,
	stable

On Mon,  1 Jul 2013 18:40:09 +0200 Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:

> When reading IIO_CHAN_INFO_OFFSET, the return value of iio_channel_read() for
> success will be IIO_VAL*, checking for 0 is not correct.

I have a canned response:

When writing a changelog, please describe the end-user-visible effects
of the bug, so that others can more easily decide which kernel
version(s) should be fixed, and so that downstream kernel maintainers
can more easily work out whether this patch will fix a problem which
they or their customers are observing.

> Cc: <stable@vger.kernel.org> # 3.10.x

Especially when cc'ing -stable.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: inkern: fix iio_convert_raw_to_processed_unlocked
  2013-07-01 22:20 ` Andrew Morton
@ 2013-07-03 19:42   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2013-07-03 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Alexandre Belloni, Jonathan Cameron, Maxime Ripard,
	Thomas Petazzoni, Gregory Clement, linux-iio, linux-kernel,
	Lars-Peter Clausen, stable

On 07/01/2013 11:20 PM, Andrew Morton wrote:
> On Mon,  1 Jul 2013 18:40:09 +0200 Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:
> 
>> When reading IIO_CHAN_INFO_OFFSET, the return value of iio_channel_read() for
>> success will be IIO_VAL*, checking for 0 is not correct.
> 
> I have a canned response:
> 
> When writing a changelog, please describe the end-user-visible effects
> of the bug, so that others can more easily decide which kernel
> version(s) should be fixed, and so that downstream kernel maintainers
> can more easily work out whether this patch will fix a problem which
> they or their customers are observing.
> 
>> Cc: <stable@vger.kernel.org> # 3.10.x
> 
> Especially when cc'ing -stable.
> 
As Andrew suggested I have added a few more details and applied the patch
to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-03 19:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-01 16:40 [PATCH] iio: inkern: fix iio_convert_raw_to_processed_unlocked Alexandre Belloni
2013-07-01 22:20 ` Andrew Morton
2013-07-03 19:42   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).