Input: tsc2005 - clear driver data after unbinding
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 17 Mar 2011 05:09:09 +0000 (22:09 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 17 Mar 2011 06:28:23 +0000 (23:28 -0700)
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>
drivers/input/touchscreen/tsc2005.c

index 596fd1f01b22bf3d72497b5493e7722c52c2ecf8..732c81e9a3e63e86950ef7ccb0e84672671ca837 100644 (file)
@@ -634,8 +634,10 @@ static int __devinit tsc2005_probe(struct spi_device *spi)
        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 @@ static int __devexit tsc2005_remove(struct spi_device *spi)
        input_unregister_device(ts->idev);
        kfree(ts);
 
+       spi_set_drvdata(spi, NULL);
        return 0;
 }