Commit b36fc07d authored by Wolfram Sang's avatar Wolfram Sang Committed by Greg Kroah-Hartman

Staging: iio: light: 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: default avatarWolfram Sang <w.sang@pengutronix.de>
Acked-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ef6d4f54
...@@ -682,6 +682,7 @@ static int __devinit tsl2563_probe(struct i2c_client *client, ...@@ -682,6 +682,7 @@ static int __devinit tsl2563_probe(struct i2c_client *client,
fail2: fail2:
iio_device_unregister(chip->indio_dev); iio_device_unregister(chip->indio_dev);
fail1: fail1:
i2c_set_clientdata(client, NULL);
kfree(chip); kfree(chip);
return err; return err;
} }
...@@ -692,6 +693,7 @@ static int tsl2563_remove(struct i2c_client *client) ...@@ -692,6 +693,7 @@ static int tsl2563_remove(struct i2c_client *client)
iio_device_unregister(chip->indio_dev); iio_device_unregister(chip->indio_dev);
i2c_set_clientdata(client, NULL);
kfree(chip); kfree(chip);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment