diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2010-03-20 11:31:46 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-03-21 04:28:34 -0400 |
commit | 395b228858778d3c44f7c413693a6acaa8bb62dc (patch) | |
tree | 89abea4e16319b41452217f49a20a810d30b50c5 | |
parent | 4d682420cead1ce06d8cd44ae193414404f0e7f5 (diff) |
mtd/maps/pismo: remove dangling pointer and a leak
While looking for drivers which forgot to clear i2c_clientdata before freeing
the data structure it points to, I found that the pismo driver even has a leak
on the probe error path.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r-- | drivers/mtd/maps/pismo.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mtd/maps/pismo.c b/drivers/mtd/maps/pismo.c index c48cad271f5d..0a5e243d2bc6 100644 --- a/drivers/mtd/maps/pismo.c +++ b/drivers/mtd/maps/pismo.c | |||
@@ -233,6 +233,7 @@ static int __devexit pismo_remove(struct i2c_client *client) | |||
233 | /* FIXME: set_vpp needs saner arguments */ | 233 | /* FIXME: set_vpp needs saner arguments */ |
234 | pismo_setvpp_remove_fix(pismo); | 234 | pismo_setvpp_remove_fix(pismo); |
235 | 235 | ||
236 | i2c_set_clientdata(client, NULL); | ||
236 | kfree(pismo); | 237 | kfree(pismo); |
237 | 238 | ||
238 | return 0; | 239 | return 0; |
@@ -271,7 +272,7 @@ static int __devinit pismo_probe(struct i2c_client *client, | |||
271 | ret = pismo_eeprom_read(client, &eeprom, 0, sizeof(eeprom)); | 272 | ret = pismo_eeprom_read(client, &eeprom, 0, sizeof(eeprom)); |
272 | if (ret < 0) { | 273 | if (ret < 0) { |
273 | dev_err(&client->dev, "error reading EEPROM: %d\n", ret); | 274 | dev_err(&client->dev, "error reading EEPROM: %d\n", ret); |
274 | return ret; | 275 | goto exit_free; |
275 | } | 276 | } |
276 | 277 | ||
277 | dev_info(&client->dev, "%.15s board found\n", eeprom.board); | 278 | dev_info(&client->dev, "%.15s board found\n", eeprom.board); |
@@ -282,6 +283,11 @@ static int __devinit pismo_probe(struct i2c_client *client, | |||
282 | pdata->cs_addrs[i]); | 283 | pdata->cs_addrs[i]); |
283 | 284 | ||
284 | return 0; | 285 | return 0; |
286 | |||
287 | exit_free: | ||
288 | i2c_set_clientdata(client, NULL); | ||
289 | kfree(pismo); | ||
290 | return ret; | ||
285 | } | 291 | } |
286 | 292 | ||
287 | static const struct i2c_device_id pismo_id[] = { | 293 | static const struct i2c_device_id pismo_id[] = { |