mmc: sdhci-msm: Fix NULL pointer dereference warnings

Fix null pointer dereference warnings in the clk scaling functions.

Change-Id: Ib33cb3be43a1d2981b9803f9c7f0880de7f17583
Signed-off-by: Sachin Gupta <quic_sachgupt@quicinc.com>
This commit is contained in:
Sachin Gupta 2023-03-13 17:30:37 +05:30
parent ab542096ab
commit c6c9f20411
2 changed files with 12 additions and 6 deletions

View File

@ -2,7 +2,7 @@
/*
* Qualcomm Technologies, Inc. SDHCI Platform driver.
*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/of_device.h>
@ -740,7 +740,7 @@ int sdhci_msm_mmc_clk_update_freq(struct sdhci_msm_host *host,
struct mmc_host *mhost = host->mmc;
int err = 0;
if (!host) {
if (!mhost) {
pr_err("bad host parameter\n");
WARN_ON(1);
return -EINVAL;
@ -1316,7 +1316,7 @@ int _sdhci_msm_mmc_suspend_clk_scaling(struct sdhci_msm_host *host)
struct mmc_host *mhost = host->mmc;
int err;
if (!host) {
if (!mhost) {
WARN(1, "bad host parameter\n");
return -EINVAL;
}
@ -1365,7 +1365,7 @@ int _sdhci_msm_mmc_resume_clk_scaling(struct sdhci_msm_host *host)
u32 devfreq_max_clk = 0;
u32 devfreq_min_clk = 0;
if (!host) {
if (!mhost) {
WARN(1, "bad host parameter\n");
return -EINVAL;
}
@ -1419,7 +1419,7 @@ int _sdhci_msm_mmc_exit_clk_scaling(struct sdhci_msm_host *host)
struct mmc_host *mhost = host->mmc;
int err;
if (!host) {
if (!mhost) {
pr_err("%s: bad host parameter\n", __func__);
WARN_ON(1);
return -EINVAL;

View File

@ -3,7 +3,7 @@
* drivers/mmc/host/sdhci-msm.c - Qualcomm SDHCI Platform driver
*
* Copyright (c) 2013-2014,2020-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
@ -4910,6 +4910,12 @@ static int sdhci_msm_probe(struct platform_device *pdev)
#if IS_ENABLED(CONFIG_MMC_SDHCI_MSM_SCALING)
pwrseq_scale = kzalloc(sizeof(struct mmc_pwrseq), GFP_KERNEL);
if (!pwrseq_scale) {
ret = -ENOMEM;
goto pm_runtime_disable;
}
pwrseq_scale->ops = &mmc_pwrseq_emmc_ops;
host->mmc->pwrseq = pwrseq_scale;
#endif