diff options
author | Pan Xinhui <xinhuix.pan@intel.com> | 2015-08-05 01:53:04 +0200 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-08-05 02:03:53 +0200 |
commit | 50fabb02c7c08dace3562c05797a3c92591a9803 (patch) | |
tree | bcda5afbd6d3414c2e01e5be0788813e3763ae60 /drivers/input | |
parent | Input: atmel_mxt_ts - remove unused defines (diff) | |
download | linux-50fabb02c7c08dace3562c05797a3c92591a9803.tar.xz linux-50fabb02c7c08dace3562c05797a3c92591a9803.zip |
Input: atmel_mxt_ts - suspend/resume causes panic if input_dev fails to init
input_dev may be NULL if mxt_initialize_input_device fails. But pm ops is
still available and suspend/resume assume
input_dev is not NULL. To fix this issue, we add a check if (!input_dev).
Signed-off-by: Pan Xinhui <xinhuix.pan@intel.com>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/atmel_mxt_ts.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index d53d4ac57f33..cf66ba1bbf0c 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -2644,6 +2644,9 @@ static int __maybe_unused mxt_suspend(struct device *dev) struct mxt_data *data = i2c_get_clientdata(client); struct input_dev *input_dev = data->input_dev; + if (!input_dev) + return 0; + mutex_lock(&input_dev->mutex); if (input_dev->users) @@ -2660,6 +2663,9 @@ static int __maybe_unused mxt_resume(struct device *dev) struct mxt_data *data = i2c_get_clientdata(client); struct input_dev *input_dev = data->input_dev; + if (!input_dev) + return 0; + mutex_lock(&input_dev->mutex); if (input_dev->users) |