[media] ts2020: cancel_delayed_work_sync before device removal / kfree

ts2020_remove  was  calling  kfree(dev)  with  possibly  still  active
schedule_delayed_work(dev->stat_work).  A similar bug in si2157 caused
kernel panics in call_timer_fn e.g. after rmmod cx23885.

Signed-off-by: Ernst Martin Witte <emw-linux-kernel@nocabal.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
Ernst Martin Witte 2016-01-09 18:18:44 -02:00 коммит произвёл Mauro Carvalho Chehab
Родитель 4fd57ed615
Коммит 41ff9142df
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -712,6 +712,10 @@ static int ts2020_remove(struct i2c_client *client)
dev_dbg(&client->dev, "\n");
/* stop statistics polling */
if (!dev->dont_poll)
cancel_delayed_work_sync(&dev->stat_work);
regmap_exit(dev->regmap);
kfree(dev);
return 0;