From: AngeloGioacchino Del Regno Date: Thu, 16 Dec 2021 12:57:47 +0000 (+0100) Subject: mmc: mtk-sd: Fix usage of devm_clk_get_optional() X-Git-Tag: v6.1-rc5~2279^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=996be7b75e8d4c44851f8a50bf7f896e32af8812;p=platform%2Fkernel%2Flinux-starfive.git mmc: mtk-sd: Fix usage of devm_clk_get_optional() If we get an error during probe of an optional clock with function devm_clk_get_optional(), this means that the clock was provided, but an error occurred: this has to be escalated to the probe function for the driver probe to fail accordingly, or unexpected hardware behavior may happen. Signed-off-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20211216125748.179602-4-angelogioacchino.delregno@collabora.com Signed-off-by: Ulf Hansson --- diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index f08695e..59d7dec 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -2528,7 +2528,7 @@ static int msdc_of_clock_parse(struct platform_device *pdev, /*source clock control gate is optional clock*/ host->src_clk_cg = devm_clk_get_optional(&pdev->dev, "source_cg"); if (IS_ERR(host->src_clk_cg)) - host->src_clk_cg = NULL; + return PTR_ERR(host->src_clk_cg); host->sys_clk_cg = devm_clk_get_optional(&pdev->dev, "sys_cg"); if (IS_ERR(host->sys_clk_cg))