From 8b4709ecea4aab1957ae7b726d6824485404a3a5 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Sat, 20 Mar 2010 15:12:58 +0100 Subject: 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 Cc: Liam Girdwood Cc: Mark Brown Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- drivers/regulator/max8649.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/regulator/max8649.c') diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c index 3ebdf69..833aaed 100644 --- a/drivers/regulator/max8649.c +++ b/drivers/regulator/max8649.c @@ -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; } -- cgit v1.1