From patchwork Mon Jan 30 04:55:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shailendra.v@samsung.com X-Patchwork-Id: 9544437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9264D604A8 for ; Mon, 30 Jan 2017 04:55:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8383D26E8A for ; Mon, 30 Jan 2017 04:55:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 737BF2833A; Mon, 30 Jan 2017 04:55:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A8C426E8A for ; Mon, 30 Jan 2017 04:55:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751750AbdA3Ezg (ORCPT ); Sun, 29 Jan 2017 23:55:36 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:35812 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751523AbdA3Eze (ORCPT ); Sun, 29 Jan 2017 23:55:34 -0500 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OKK02TGHTOGMQ50@mailout2.samsung.com>; Mon, 30 Jan 2017 13:55:28 +0900 (KST) Received: from epsmges2p1.samsung.com (unknown [182.195.42.69]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20170130045528epcas2p1ea6680372c707cb5cdaa206ea008d608~ec7BHOsZp3054630546epcas2p1R; Mon, 30 Jan 2017 04:55:28 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 19.BD.06719.F37CE885; Mon, 30 Jan 2017 13:55:27 +0900 (KST) Received: from epsmgmsp02.samsung.com (unknown [182.195.34.23]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20170130045527epcas2p18ca90e9cd6b0a6153bf941eec4f40ddf~ec7A7q24t0332403324epcas2p1R; Mon, 30 Jan 2017 04:55:27 +0000 (GMT) X-AuditID: b6c32a45-f79966d000001a3f-9b-588ec73fbe3a Received: from srin.p4 (Unknown_Domain [107.108.168.37]) by epsmgmsp02.samsung.com (EPCPMTA) with SMTP id 87.24.04860.A37CE885; Mon, 30 Jan 2017 13:55:27 +0900 (KST) From: Shailendra Verma To: Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, p.shailesh@samsung.com, ashish.kalra@samsung.com, Shailendra Verma , Shailendra Verma Subject: [PATCH] spi - Fix possible NULL derefrence. Date: Mon, 30 Jan 2017 10:25:13 +0530 Message-id: <1485752113-29581-1-git-send-email-shailendra.v@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrEIsWRmVeSWpSXmKPExsWy7bCmha798b4Igx2PrS3uT/vGbjH14RM2 i8u75rBZNH68yW6xY0ori8WteTPZLBZ9e8XswO6xc9Zddo9NqzrZPPq2rGL0+LxJLoAlissm JTUnsyy1SN8ugSvjyrUZrAWvWCuO/P7J2sD4iKWLkZNDQsBE4sjHjUwQtpjEhXvr2boYuTiE BHYwSqzpusoC4XxmlPgwrYsZpmPJ5w52iMRKRon3zVPYQBJsAoYSr/v+MoEkRAS+MEp0PGsH SwgDdUxsbgOzWQRUJW7+/cwOYvMKeEic7fnM2sX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NITS1KzU1MLUotg+pg4OKUaGHnLGcocl1s1LGUs q7ji/qNzDt/NxaL6c9fOPcneNKlcw+7h/Sj5i2/mVIrsS+IKrJO4MKNmh2cR/7K5DSUX5MvW +y9ZKDSPrSpng8mtFJG5/Il7/v/jlygJ2l6i43N25XTu2j+Rr5MKLv49GFHpuPfpBqbYCGu1 5F9xIhubGu2rN19dtSv9rRJLcUaioRZzUXEiAA7w/+5IAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170130045527epcas2p18ca90e9cd6b0a6153bf941eec4f40ddf X-Msg-Generator: CA X-Sender-IP: 182.195.34.23 X-Local-Sender: =?UTF-8?B?U2hhaWxlbmRyYSBWZXJtYRtTUkktTm9pZGEtQ29tbWVyY2lh?= =?UTF-8?B?bCBSJkQgIFN5c3RlbSBTL1cgR3JvdXAb7IK87ISx7KCE7J6QG0xlYWQgRW5n?= =?UTF-8?B?aW5lZXIvQ29ycG9yYXRlIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?U2hhaWxlbmRyYSBWZXJtYRtTUkktTm9pZGEtQ29tbWVyY2lh?= =?UTF-8?B?bCBSJkQgIFN5c3RlbSBTL1cgR3JvdXAbU2Ftc3VuZyBFbGVjdHJvbmljcxtM?= =?UTF-8?B?ZWFkIEVuZ2luZWVyL0NvcnBvcmF0ZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG1NXQUhRG0MxMElaMDFJWjAxODEyMA==?= CMS-TYPE: 102P X-HopCount: 7 X-CMS-RootMailID: 20170130045527epcas2p18ca90e9cd6b0a6153bf941eec4f40ddf X-RootMTR: 20170130045527epcas2p18ca90e9cd6b0a6153bf941eec4f40ddf References: Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP of_match_device could return NULL, and so can cause a NULL pointer dereference later. Signed-off-by: Shailendra Verma --- drivers/spi/spi-mxs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index 5b0e9a3..c3aea7e 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c @@ -470,6 +470,11 @@ static int mxs_spi_probe(struct platform_device *pdev) */ const int clk_freq_default = 160000000; + if (!of_id) { + dev_err(&pdev->dev, "Error: No device match found\n"); + return -ENODEV; + } + iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); irq_err = platform_get_irq(pdev, 0); if (irq_err < 0)