From patchwork Wed May 15 15:16:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2573601 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id D00CADF2A2 for ; Wed, 15 May 2013 15:17:10 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UcdS0-000515-JW; Wed, 15 May 2013 15:17:08 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UcdRx-0003La-Th; Wed, 15 May 2013 15:17:05 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UcdRu-0003KV-V6 for linux-arm-kernel@lists.infradead.org; Wed, 15 May 2013 15:17:04 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MMU009ZQIFD6560@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 15 May 2013 16:16:31 +0100 (BST) X-AuditID: cbfec7f5-b7f376d000001ec6-af-5193a6cf78ed Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 6C.DA.07878.FC6A3915; Wed, 15 May 2013 16:16:31 +0100 (BST) Received: from amdc1227.digital.local ([106.116.147.199]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0MMU00H5XIFG1OB0@eusync2.samsung.com>; Wed, 15 May 2013 16:16:31 +0100 (BST) From: Tomasz Figa To: linux-samsung-soc@vger.kernel.org Subject: [PATCH] rtc: max8998: Check for pdata presence before dereferencing Date: Wed, 15 May 2013 17:16:08 +0200 Message-id: <1368630968-30460-1-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.8.2.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHJMWRmVeSWpSXmKPExsVy+t/xK7rnl00ONPj0Q91iycWr7BYv7l1k sTjb9IbdYtPja6wWM87vY7LY39nBaLF+xmsWB3aPPRNPsnlsXlLv0bdlFaPH9Hk/mTw+b5IL YI3isklJzcksSy3St0vgytjdt5654Cl7RevXkywNjAfYuhg5OSQETCRa1pxjh7DFJC7cWw8U 5+IQEljKKPF08wZmCKePSWLTpxVMIFVsAmoSnxsegXWLCKhKfG5bwA5SxCxwhFHiyu1WVpCE sICPxMsTE8HGsgAVTd32GKyZV8BJomHva0aIdQoSx7dvY5zAyL2AkWEVo2hqaXJBcVJ6rpFe cWJucWleul5yfu4mRkiYfN3BuPSY1SFGAQ5GJR5ey+mTA4VYE8uKK3MPMUpwMCuJ8GpPBArx piRWVqUW5ccXleakFh9iZOLglGpgbH/m9U1A0SJn9edTtwuuGzx6rOPjrZsW7P7p3m4FNZHN 698IP7bNO8PP81V8z+0Uf6meHrW9Yvcd487LHLo2d99C+ekh33hOzWkQ90nVWWUutaBvqv30 pYwn7j9j5nz+Nqb1xlEjLc+zt+tCveSLcgQ++1w3lTKJmRt2s+DIvE3Bcmo8uVNalViKMxIN tZiLihMBT0ciVfEBAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130515_111703_091079_D19552E2 X-CRM114-Status: UNSURE ( 8.94 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -7.5 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [210.118.77.12 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: a.zummo@towertech.it, jy0922.shim@samsung.com, rtc-linux@googlegroups.com, Tomasz Figa , Kyungmin Park , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Currently the driver can crash with a NULL pointer dereference if no pdata is provided, despite of successful registration of MFD part. This patch fixes the problem by adding a NULL check before dereferencing the pdata pointer. Signed-off-by: Tomasz Figa Signed-off-by: Kyungmin Park --- drivers/rtc/rtc-max8998.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c index 48b6612..d5af7ba 100644 --- a/drivers/rtc/rtc-max8998.c +++ b/drivers/rtc/rtc-max8998.c @@ -285,7 +285,7 @@ static int max8998_rtc_probe(struct platform_device *pdev) info->irq, ret); dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name); - if (pdata->rtc_delay) { + if (pdata && pdata->rtc_delay) { info->lp3974_bug_workaround = true; dev_warn(&pdev->dev, "LP3974 with RTC REGERR option." " RTC updates will be extremely slow.\n");