From patchwork Mon Jan 30 05:04:58 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: 9544461 X-Patchwork-Delegate: eduardo.valentin@ti.com 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 928D660415 for ; Mon, 30 Jan 2017 05:05:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85BB820265 for ; Mon, 30 Jan 2017 05:05:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A79F2711E; Mon, 30 Jan 2017 05:05:34 +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 57E0620265 for ; Mon, 30 Jan 2017 05:05:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752002AbdA3FFb (ORCPT ); Mon, 30 Jan 2017 00:05:31 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:38809 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752221AbdA3FF2 (ORCPT ); Mon, 30 Jan 2017 00:05:28 -0500 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OKK01L9IU52ND50@mailout4.samsung.com>; Mon, 30 Jan 2017 14:05:26 +0900 (KST) Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20170130050525epcas1p35ac4e47886c09b09bab0452a590cbd63~edDt9YTq71052210522epcas1p3r; Mon, 30 Jan 2017 05:05:25 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 3A.6F.06735.599CE885; Mon, 30 Jan 2017 14:05:25 +0900 (KST) Received: from epsmgmsp01.samsung.com (unknown [182.195.34.22]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20170130050525epcas1p3686ebf52f0215eef64a358338843305d~edDtnDX_t1052210522epcas1p3q; Mon, 30 Jan 2017 05:05:25 +0000 (GMT) X-AuditID: b6c32a36-f79dd6d000001a4f-09-588ec9956611 Received: from srin.p4 (Unknown_Domain [107.108.168.37]) by epsmgmsp01.samsung.com (EPCPMTA) with SMTP id C2.74.04803.389CE885; Mon, 30 Jan 2017 14:05:25 +0900 (KST) From: Shailendra Verma To: Zhang Rui , Eduardo Valentin , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, p.shailesh@samsung.com, ashish.kalra@samsung.com, Shailendra Verma , Shailendra Verma Subject: [PATCH] Thermal - Fix possible NULL derefrence. Date: Mon, 30 Jan 2017 10:34:58 +0530 Message-id: <1485752698-30248-1-git-send-email-shailendra.v@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRmVeSWpSXmKPExsWy7bCmru7Uk30RBq3nzS3uT/vGbjH/yjVW i8u75rBZfO49wmixY0ori8WTh31sFrfmzWSzWPTtFbMDh8fOWXfZPRbvecnk0bdlFaPH501y ASxRXDYpqTmZZalF+nYJXBmztzxjKjjEVrHs/lWmBsYdrF2MnBwSAiYSa0/+ZoKwxSQu3FvP 1sXIxSEksINRYsOPmYwQzmdGibmTDsF13Dv8GcwWEljJKHFrMweIzSZgKPG67y8TSIOIwFwm ifVrjrKAJIQFLCRm/rk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E1MLCwsTS2NjYwkRJnDd2+rNwIYH0xJLU7NTUgtQimD4mDk6pBkZD59mZ +e5fuvyPBk/8lRB32WMBz6zrHOE7VhfWPz9sw6V9bO1L66bsDZ2W0Wt5a1czpPrtWBwU2P+e 1Z2rW/O0yDofeaXIBYvuy637WZSsWfrP8f2jB41n8psFpwR9VH946rBQpPbRj/ePfNjQt7VF 69a0DRd6LQ7rt6ucTT2ocr/o4iQD45tKLMUZiYZazEXFiQADeFZxTQIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170130050525epcas1p3686ebf52f0215eef64a358338843305d X-Msg-Generator: CA X-Sender-IP: 182.195.34.22 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: 101P X-HopCount: 7 X-CMS-RootMailID: 20170130050525epcas1p3686ebf52f0215eef64a358338843305d X-RootMTR: 20170130050525epcas1p3686ebf52f0215eef64a358338843305d References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP of_device_get_match_data could return NULL, and so can cause a NULL pointer dereference later. Signed-off-by: Shailendra Verma --- drivers/thermal/imx_thermal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 06912f0..fb648a4 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -489,6 +489,10 @@ static int imx_thermal_probe(struct platform_device *pdev) data->tempmon = map; data->socdata = of_device_get_match_data(&pdev->dev); + if (!data->socdata) { + dev_err(&pdev->dev, "no device match found\n"); + return -ENODEV; + } /* make sure the IRQ flag is clear before enabling irq on i.MX6SX */ if (data->socdata->version == TEMPMON_IMX6SX) {