[<prev] [next>] [day] [month] [year] [list]
Message-ID: <5539BE20.7020807@intel.com>
Date: Fri, 24 Apr 2015 11:53:04 +0800
From: Pan Xinhui <xinhuix.pan@...el.com>
To: linux-kernel@...r.kernel.org
CC: dmitry.torokhov@...il.com, nick.dyer@...ev.co.uk,
miletus@...omium.org, bleung@...omium.org, djkurtz@...omium.org,
mnipxh@....com
Subject: [PATCH] touchscreen:atmel_mxt_ts: suspend/resume cause 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: xinhui.pan <xinhuix.pan@...el.com>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 2875ddf..a39e0dc 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -2500,6 +2500,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)
@@ -2516,6 +2519,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;
+
mxt_soft_reset(data);
mutex_lock(&input_dev->mutex);
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists