mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-01 10:43:43 +00:00
regulator: fix dangling pointers
Fix I2C-drivers which missed setting clientdata to NULL before freeing the structure it points to. Also fix drivers which do this _after_ the structure was freed already. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Liam Girdwood <lrg@slimlogic.co.uk> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
This commit is contained in:
parent
451a73cd46
commit
8b4709ecea
@ -243,8 +243,8 @@ static int __devexit max1586_pmic_remove(struct i2c_client *client)
|
||||
for (i = 0; i <= MAX1586_V6; i++)
|
||||
if (rdev[i])
|
||||
regulator_unregister(rdev[i]);
|
||||
kfree(rdev);
|
||||
i2c_set_clientdata(client, NULL);
|
||||
kfree(rdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -356,6 +356,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
|
||||
dev_info(info->dev, "Max8649 regulator device is detected.\n");
|
||||
return 0;
|
||||
out:
|
||||
i2c_set_clientdata(client, NULL);
|
||||
kfree(info);
|
||||
return ret;
|
||||
}
|
||||
@ -367,9 +368,9 @@ static int __devexit max8649_regulator_remove(struct i2c_client *client)
|
||||
if (info) {
|
||||
if (info->regulator)
|
||||
regulator_unregister(info->regulator);
|
||||
i2c_set_clientdata(client, NULL);
|
||||
kfree(info);
|
||||
}
|
||||
i2c_set_clientdata(client, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -470,8 +470,8 @@ static int __devexit max8660_remove(struct i2c_client *client)
|
||||
for (i = 0; i < MAX8660_V_END; i++)
|
||||
if (rdev[i])
|
||||
regulator_unregister(rdev[i]);
|
||||
kfree(rdev);
|
||||
i2c_set_clientdata(client, NULL);
|
||||
kfree(rdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user