public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: iio: accel: fix error check
@ 2016-05-31 21:08 Luis de Bethencourt
  2016-05-31 21:08 ` [PATCH 2/2] staging: iio: accel: add " Luis de Bethencourt
  2016-05-31 21:10 ` [PATCH 1/2] staging: iio: accel: fix " Luis de Bethencourt
  0 siblings, 2 replies; 3+ messages in thread
From: Luis de Bethencourt @ 2016-05-31 21:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: gregkh, knaack.h, lars, jic23, ciorneiioana, janani.rvchndrn, afd,
	linux-iio, devel, Luis de Bethencourt

sca3000_read_ctrl_reg() returns a negative number on failure, check for
this instead of zero.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Jonathan Cameron <jic23@kernel.org>
---

Patch corrected thanks to comments from Andrew F. Davis and Jonathan Cameron.
https://lkml.org/lkml/2016/5/31/862

Thanks,
Luis

 drivers/staging/iio/accel/sca3000_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c
index a8f533a..ec12181 100644
--- a/drivers/staging/iio/accel/sca3000_core.c
+++ b/drivers/staging/iio/accel/sca3000_core.c
@@ -594,7 +594,7 @@ static ssize_t sca3000_read_frequency(struct device *dev,
 		goto error_ret_mut;
 	ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL);
 	mutex_unlock(&st->lock);
-	if (ret)
+	if (ret < 0)
 		goto error_ret;
 	val = ret;
 	if (base_freq > 0)
-- 
2.5.1

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

end of thread, other threads:[~2016-05-31 21:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-31 21:08 [PATCH 1/2] staging: iio: accel: fix error check Luis de Bethencourt
2016-05-31 21:08 ` [PATCH 2/2] staging: iio: accel: add " Luis de Bethencourt
2016-05-31 21:10 ` [PATCH 1/2] staging: iio: accel: fix " Luis de Bethencourt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox