aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max8660.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2015-04-07 18:06:46 -0400
committerMark Brown <broonie@kernel.org>2015-04-08 07:01:10 -0400
commitdfb85ba1140ab649f6f0bf3e502ac37c0f69dbcb (patch)
treeed0ddba2eb9b89632c9afa9f17464b626d8725a8 /drivers/regulator/max8660.c
parentc517d838eb7d07bbe9507871fab3931deccff539 (diff)
regulator: max8660: fix assignment of pdata to data that becomes dead
pdata is assigned to &pdata_of, however, pdata_of becomes dead (when it goes out of scope) so pdata effectively becomes a dead pointer to the out of scope object. This is detected by static analysis: [drivers/regulator/max8660.c:411]: (error) Dead pointer usage. Pointer 'pdata' is dead if it has been assigned '&pdata_of' at line 404. Move declaration of pdata_of so it is always in scope. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/max8660.c')
-rw-r--r--drivers/regulator/max8660.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c
index 7eee2ca18541..f187c8f13e22 100644
--- a/drivers/regulator/max8660.c
+++ b/drivers/regulator/max8660.c
@@ -382,7 +382,7 @@ static int max8660_probe(struct i2c_client *client,
382 const struct i2c_device_id *i2c_id) 382 const struct i2c_device_id *i2c_id)
383{ 383{
384 struct device *dev = &client->dev; 384 struct device *dev = &client->dev;
385 struct max8660_platform_data *pdata = dev_get_platdata(dev); 385 struct max8660_platform_data pdata_of, *pdata = dev_get_platdata(dev);
386 struct regulator_config config = { }; 386 struct regulator_config config = { };
387 struct max8660 *max8660; 387 struct max8660 *max8660;
388 int boot_on, i, id, ret = -EINVAL; 388 int boot_on, i, id, ret = -EINVAL;
@@ -391,7 +391,6 @@ static int max8660_probe(struct i2c_client *client,
391 391
392 if (dev->of_node && !pdata) { 392 if (dev->of_node && !pdata) {
393 const struct of_device_id *id; 393 const struct of_device_id *id;
394 struct max8660_platform_data pdata_of;
395 394
396 id = of_match_device(of_match_ptr(max8660_dt_ids), dev); 395 id = of_match_device(of_match_ptr(max8660_dt_ids), dev);
397 if (!id) 396 if (!id)