linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Dyer <nick.dyer@itdev.co.uk>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, Alan Bowens <Alan.Bowens@atmel.com>,
	Pan Xinhui <xinhuix.pan@intel.com>,
	Nick Dyer <nick.dyer@itdev.co.uk>
Subject: [PATCH 5/9] Input: atmel_mxt_ts - suspend/resume causes panic if input_dev fails to init
Date: Mon,  3 Aug 2015 16:23:13 +0100	[thread overview]
Message-ID: <1438615397-17112-6-git-send-email-nick.dyer@itdev.co.uk> (raw)
In-Reply-To: <1438615397-17112-1-git-send-email-nick.dyer@itdev.co.uk>

From: Pan Xinhui <xinhuix.pan@intel.com>

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>
---
 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 869dbb3..b83e8a0 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -2653,6 +2653,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)
@@ -2669,6 +2672,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)
-- 
2.4.6


  parent reply	other threads:[~2015-08-03 15:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 15:23 atmel_mxt_ts - suspend patch and minor fixes Nick Dyer
2015-08-03 15:23 ` [PATCH 1/9] MAINTAINERS: Add maintainer for atmel_mxt_ts Nick Dyer
2015-08-03 15:23 ` [PATCH 2/9] Input: atmel_mxt_ts - use deep sleep mode when stopped Nick Dyer
2015-08-05  0:02   ` Dmitry Torokhov
2015-08-06 13:04     ` Nick Dyer
2015-08-06 22:57       ` Dmitry Torokhov
2015-08-10 20:11   ` Benjamin Tissoires
2015-08-11 14:24     ` Nick Dyer
2015-08-11 15:55       ` Nick Dyer
2015-08-11 16:29         ` Benjamin Tissoires
2015-08-11 18:32           ` Nick Dyer
2015-08-03 15:23 ` [PATCH 3/9] Input: atmel_mxt_ts - remove unused defines Nick Dyer
2015-08-03 15:23 ` [PATCH 4/9] Input: atmel_mxt_ts - move mxt_initialize after sysfs init Nick Dyer
2015-08-05  0:00   ` Dmitry Torokhov
2015-08-03 15:23 ` Nick Dyer [this message]
2015-08-03 15:23 ` [PATCH 6/9] Input: atmel_mxt_ts - improve device tree parsing Nick Dyer
2015-08-03 15:23 ` [PATCH 7/9] Input: atmel_mxt_ts - disable interrupt for 50ms after reset Nick Dyer
2015-08-03 15:23 ` [PATCH 8/9] Input: atmel_mxt_ts - initialise input slots with INPUT_MT_DIRECT Nick Dyer
2015-08-03 15:23 ` [PATCH 9/9] Input: atmel_mxt_ts - remove warning on zero T44 count Nick Dyer
2015-08-05  0:03 ` atmel_mxt_ts - suspend patch and minor fixes Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438615397-17112-6-git-send-email-nick.dyer@itdev.co.uk \
    --to=nick.dyer@itdev.co.uk \
    --cc=Alan.Bowens@atmel.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=xinhuix.pan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).