Skip to content

Commit

Permalink
Input: tsc2005 - clear driver data after unbinding
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dmitry Torokhov committed Mar 17, 2011
1 parent b88aa49 commit 2721a89
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/input/touchscreen/tsc2005.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit 2721a89

Please sign in to comment.