Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752843AbbGNOyn (ORCPT ); Tue, 14 Jul 2015 10:54:43 -0400 Received: from mga09.intel.com ([134.134.136.24]:15428 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751644AbbGNOyl (ORCPT ); Tue, 14 Jul 2015 10:54:41 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,472,1432623600"; d="scan'208";a="746952419" From: Daniel Baluta To: jic23@kernel.org Cc: daniel.baluta@intel.com, viorel.suman@intel.com, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] iio: magnetometer: mmc35240: Fix crash in pm suspend Date: Tue, 14 Jul 2015 17:56:52 +0300 Message-Id: <1436885814-29155-2-git-send-email-daniel.baluta@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436885814-29155-1-git-send-email-daniel.baluta@intel.com> References: <1436885814-29155-1-git-send-email-daniel.baluta@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1539 Lines: 41 We must set i2c client private data at probe in order to correctly retrieve it in pm suspend/resume, preventing the following crash: [ 321.790582] PM: Syncing filesystems ... done. [ 322.364440] PM: Preparing system for mem sleep [ 322.400047] PM: Entering mem sleep [ 322.462178] BUG: unable to handle kernel NULL pointer dereference at 0000036c [ 322.469119] IP: [<80e0b3d2>] mmc35240_suspend+0x12/0x30 [ 322.474291] *pdpt = 000000002fd6f001 *pde = 0000000000000000 [ 322.479967] Oops: 0000 1 PREEMPT SMP [ 322.496516] task: a86d0df0 ti: a8766000 task.ti: a8766000 [ 322.570744] Call Trace: [ 322.573217] [<80c0d2d1>] pm_generic_suspend+0x21/0x30 [ 322.578284] [<80d042ab>] i2c_device_pm_suspend+0x1b/0x30 Signed-off-by: Daniel Baluta --- drivers/iio/magnetometer/mmc35240.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c index 7a2ea71..e89b059 100644 --- a/drivers/iio/magnetometer/mmc35240.c +++ b/drivers/iio/magnetometer/mmc35240.c @@ -496,6 +496,7 @@ static int mmc35240_probe(struct i2c_client *client, } data = iio_priv(indio_dev); + i2c_set_clientdata(client, indio_dev); data->client = client; data->regmap = regmap; data->res = MMC35240_16_BITS_SLOW; -- 1.9.1 -- 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/