Skip to content

Commit

Permalink
Staging: iio: adc: fix dangling pointers
Browse files Browse the repository at this point in the history
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>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Wolfram Sang authored and Greg Kroah-Hartman committed Apr 30, 2010
1 parent b36fc07 commit ee58cb2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/iio/adc/max1363_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ static int __devinit max1363_probe(struct i2c_client *client,
if (!IS_ERR(st->reg))
regulator_put(st->reg);
error_free_st:
i2c_set_clientdata(client, NULL);
kfree(st);

error_ret:
Expand All @@ -574,6 +575,7 @@ static int max1363_remove(struct i2c_client *client)
regulator_disable(st->reg);
regulator_put(st->reg);
}
i2c_set_clientdata(client, NULL);
kfree(st);

return 0;
Expand Down

0 comments on commit ee58cb2

Please sign in to comment.