Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933833AbbDWDy1 (ORCPT ); Wed, 22 Apr 2015 23:54:27 -0400 Received: from mga09.intel.com ([134.134.136.24]:33838 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753584AbbDWDyY (ORCPT ); Wed, 22 Apr 2015 23:54:24 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,628,1422950400"; d="scan'208";a="717863428" Message-ID: <5539BE20.7020807@intel.com> Date: Fri, 24 Apr 2015 11:53:04 +0800 From: Pan Xinhui User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: linux-kernel@vger.kernel.org CC: dmitry.torokhov@gmail.com, nick.dyer@itdev.co.uk, miletus@chromium.org, bleung@chromium.org, djkurtz@chromium.org, mnipxh@163.com Subject: [PATCH] touchscreen:atmel_mxt_ts: suspend/resume cause panic if input_dev fails to init Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1369 Lines: 38 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 --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/