Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4802558pxu; Tue, 22 Dec 2020 00:51:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJzV98J48yi9JEPbZsORAdZL9fj1BBlox7hZnjCmIZL+l4mHNBk1kctrH+GMYpbghzFzGv5X X-Received: by 2002:a17:906:1197:: with SMTP id n23mr18951113eja.359.1608627097523; Tue, 22 Dec 2020 00:51:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608627097; cv=none; d=google.com; s=arc-20160816; b=O/aGoTB+tqRkLdTyuKfkeyrTIT8SOR2zEzeWvY/K/HIihwgp8ZYWdRbhm3N3r+OIKN V7a7C0oyt6WtMblMoOjdqZ15L9xg6tWYZX4uYVIzQ2NNg4akOmrM7TVKUwH3DiNNtAcX L3R/1TSTUjUA2W81nKO6H73A5ACAEftgBMLWdfrgxCO52zdV/IxlNAoskhOuUJwnf82l eOc3Wea8nSUEbuiDzLOTpO2b/DWL32uzF0VxpGqXul25AV18jK+CqSsuEN5bR1a8RGcC FqHi+JJdWqu0d1jc0/QKb3cWdRKMAnlxAIppPQgIBLYav1l5Zt+J8AVnFjGdFJ+q/aJQ gHyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=VLbGsggqeyIO5+Xo4HtQwVaKJP0rgnoy4oGXecTc3Zs=; b=QOAn4vIL4OID68Vc38xwg7+hPE188QmEHeuZkHJlxUO9CvRxULs/jNXZPmTXG5eD5v ArEAecVYrnkEoiKUoM6j6fpFImzZL5SEfbKskBhQEpUKcVe9SCyaSanZz8sZWK93znGC Jwh6Neax9jWLIc7b1ECZ0Brui3papyiXw1Tbc7ZmQtr1uUTFOdOmuzgS69qhuk9VL1x6 KFCzdim/6moCatDLQl6wL4pouRNv3/LDIz+uXr5gWTOXzVCTmBvgmpurxXhxzeKJmu5M UAGT+0LMOUW6oOpBSXRquQUpGWoYfMTVIZV7Mzwa+OXQCtsszH5wECXpdZmv1wiA+qZM +X0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h24si11354441ejt.452.2020.12.22.00.51.15; Tue, 22 Dec 2020 00:51:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726024AbgLVIti (ORCPT + 99 others); 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-kernel@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 --- 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; -- 2.7.4