Input: tsc2005 - clear driver data after unbinding
We should not leave garbage pointers in driver structure after we unbind
it from the device or if bind fails.
Tested-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index 596fd1f..732c81e 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -634,8 +634,10 @@
spi_setup(spi);
r = tsc2005_setup(ts, pdata);
- if (r)
+ if (r) {
kfree(ts);
+ spi_set_drvdata(spi, NULL);
+ }
return r;
}
@@ -659,6 +661,7 @@
input_unregister_device(ts->idev);
kfree(ts);
+ spi_set_drvdata(spi, NULL);
return 0;
}