From patchwork Tue Dec 22 08:48:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Md Sadre Alam X-Patchwork-Id: 346672 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E095C433E6 for ; Tue, 22 Dec 2020 08:49:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2AEF223127 for ; Tue, 22 Dec 2020 08:49:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726012AbgLVIti (ORCPT ); Tue, 22 Dec 2020 03:49:38 -0500 Received: from alexa-out.qualcomm.com ([129.46.98.28]:45532 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725300AbgLVIth (ORCPT ); Tue, 22 Dec 2020 03:49:37 -0500 Received: from ironmsg07-lv.qualcomm.com (HELO ironmsg07-lv.qulacomm.com) ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 22 Dec 2020 00:48:56 -0800 X-QCInternal: smtphost Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg07-lv.qulacomm.com with ESMTP/TLS/AES256-SHA; 22 Dec 2020 00:48:55 -0800 X-QCInternal: smtphost Received: from mdalam-linux.qualcomm.com ([10.201.2.71]) by ironmsg01-blr.qualcomm.com with ESMTP; 22 Dec 2020 14:18:38 +0530 Received: by mdalam-linux.qualcomm.com (Postfix, from userid 466583) id 3E7A421BA0; Tue, 22 Dec 2020 14:18:37 +0530 (IST) From: Md Sadre Alam To: bjorn.andersson@linaro.org, adrian.hunter@intel.com, ulf.hansson@linaro.org, linux-arm-msm@vger.kernel.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: mdalam@codeaurora.org, sricharan@codeaurora.org Subject: [PATCH] mmc: sdhci-msm: Fix possible NULL pointer exception Date: Tue, 22 Dec 2020 14:18:33 +0530 Message-Id: <1608626913-16675-1-git-send-email-mdalam@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org of_device_get_match_data returns NULL when no match. So add the NULL pointer check to avoid dereference. Signed-off-by: Md Sadre Alam Reviewed-by: Veerabhadrarao Badiganti --- drivers/mmc/host/sdhci-msm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 9c7927b..f20e424 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -2235,6 +2235,8 @@ static int sdhci_msm_probe(struct platform_device *pdev) * the data associated with the version info. */ var_info = of_device_get_match_data(&pdev->dev); + if (!var_info) + goto pltfm_free; msm_host->mci_removed = var_info->mci_removed; msm_host->restore_dll_config = var_info->restore_dll_config;