lkml.org 
[lkml]   [2021]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] mmc: sdhci-msm: Fix possible NULL pointer exception
From
Date
On 22/12/20 10:48 am, Md Sadre Alam wrote:
> 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 <mdalam@codeaurora.org>
> ---
> 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)

Shouldn't you set ret to -ENODEV here?

> + goto pltfm_free;
>
> msm_host->mci_removed = var_info->mci_removed;
> msm_host->restore_dll_config = var_info->restore_dll_config;
>

\
 
 \ /
  Last update: 2021-01-05 15:43    [W:0.060 / U:2.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site