lkml.org 
[lkml]   [2011]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] drivers: staging: iio: adc: fix uninitialized use
Date
Fixed an uninitialized variable access. In the first two error paths in
max1363_probe(), 'st' is not yet initialized, but its 'reg' member is
accessed anyway. This would most likely crash.

The intended value for st->reg *is* available at that point in 'reg',
so just use that directly.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
---
drivers/staging/iio/adc/max1363_core.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/adc/max1363_core.c b/drivers/staging/iio/adc/max1363_core.c
index 98cebd2..ebecf14 100644
--- a/drivers/staging/iio/adc/max1363_core.c
+++ b/drivers/staging/iio/adc/max1363_core.c
@@ -1335,11 +1335,11 @@ error_free_device:
else
iio_device_unregister(indio_dev);
error_disable_reg:
- if (!IS_ERR(st->reg))
- regulator_disable(st->reg);
+ if (!IS_ERR(reg))
+ regulator_disable(reg);
error_put_reg:
- if (!IS_ERR(st->reg))
- regulator_put(st->reg);
+ if (!IS_ERR(reg))
+ regulator_put(reg);

return ret;
}
--
1.7.4.1


\
 
 \ /
  Last update: 2011-07-03 03:49    [W:7.380 / U:0.640 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site