]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/staging/iio/light/tsl2563.c
Staging: iio: light: fix dangling pointers
[net-next-2.6.git] / drivers / staging / iio / light / tsl2563.c
index 78b9432c81057bcf8b019bf9835c32d2e5d875b2..8770a00e365225239b98e0f46e4868a02e1957fa 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/pm.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
+#include <linux/slab.h>
 
 #include "../iio.h"
 #include "tsl2563.h"
@@ -681,6 +682,7 @@ static int __devinit tsl2563_probe(struct i2c_client *client,
 fail2:
        iio_device_unregister(chip->indio_dev);
 fail1:
+       i2c_set_clientdata(client, NULL);
        kfree(chip);
        return err;
 }
@@ -691,6 +693,7 @@ static int tsl2563_remove(struct i2c_client *client)
 
        iio_device_unregister(chip->indio_dev);
 
+       i2c_set_clientdata(client, NULL);
        kfree(chip);
        return 0;
 }