linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/11] iio: sensors-core: st: Check st_sensors_set_drdy_int_pin()'s return value
@ 2014-08-28 13:14 Lee Jones
  2014-08-28 13:14 ` [PATCH 02/11] misc: st_core: Protect unsigned value against becoming negative Lee Jones
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Lee Jones @ 2014-08-28 13:14 UTC (permalink / raw)
  To: linux-arm-kernel

Value from st_sensors_set_drdy_int_pin() is assigned to err here,
but that stored value is not used before it is overwritten.  To fix
this we're enforcing a check on st_sensors_set_drdy_int_pin()'s
return value and if it's an error, we're returning right away.

Cc: jic23 at kernel.org
Cc: linux-iio at vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 8a4ec00..24cfe4e 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -306,8 +306,11 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
 	if (of_pdata)
 		pdata = of_pdata;
 
-	if (pdata)
+	if (pdata) {
 		err = st_sensors_set_drdy_int_pin(indio_dev, pdata);
+		if (err < 0)
+			return err;
+	}
 
 	err = st_sensors_set_enable(indio_dev, false);
 	if (err < 0)
-- 
1.9.1

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

end of thread, other threads:[~2014-08-30  9:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-28 13:14 [PATCH 01/11] iio: sensors-core: st: Check st_sensors_set_drdy_int_pin()'s return value Lee Jones
2014-08-28 13:14 ` [PATCH 02/11] misc: st_core: Protect unsigned value against becoming negative Lee Jones
2014-08-28 13:14 ` [PATCH 03/11] misc: st_kim: Increase size of dev_name buffer to incorporate termination Lee Jones
2014-08-28 13:14 ` [PATCH 04/11] mfd: htc-i2cpld: container_of() cannot return NULL Lee Jones
2014-08-28 13:14 ` [PATCH 05/11] mfd: htc-i2cpld: Use '!variable' instead of 'variable == NULL' Lee Jones
2014-08-28 13:14 ` [PATCH 06/11] mfd: htc-i2cpld: Rectify pointer offset error Lee Jones
2014-08-28 13:14 ` [PATCH 07/11] mfd: wm5102: Insert missing break in case statement Lee Jones
2014-08-28 13:14 ` [PATCH 08/11] mfd: max77686: Remove check which is always true Lee Jones
2014-08-28 13:14 ` [PATCH 09/11] mfd: pcf50633: Check return value of platform_device_add() Lee Jones
2014-08-28 13:14 ` [PATCH 10/11] mfd: twl4030-irq: Check return value from twl_i2c_write() - warn() on failure Lee Jones
2014-08-28 13:14 ` [PATCH 11/11] mfd: sm501: Avoid implicit sign extension Lee Jones
2014-08-30  9:49 ` [PATCH 01/11] iio: sensors-core: st: Check st_sensors_set_drdy_int_pin()'s return value 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).