Skip to contentSkip to conversation

mmc: sdhci-of-dwcmshc: fix error return code in dwcmshc_probe()

PATCH In review 'w00385741 2 participants 2 messages Mar 23, 2021 – Mar 24, 2021

Subsystems (3)
lore
Share & tools
lore

'w00385741

author
#0 lore raw

PATCH 1/1 mmc: sdhci-of-dwcmshc: fix error return code in dwcmshc_probe()

From: Wei Yongjun <[email protected]>

Fix to return negative error code -ENOMEM from the error handling case instead of 0, as done elsewhere in this function.

Fixes c2c4da37837e ("mmc: sdhci-of-dwcmshc: add rockchip platform support")
---
 drivers/mmc/host/sdhci-of-dwcmshc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-of-dwcmshc.c +3 -1
index 06873686d5e9..e96c628aeeeb 100644
@@ -383,8 +383,10 @@ static int dwcmshc_probe(struct platform_device *pdev)
 
 	if (pltfm_data == &sdhci_dwcmshc_rk3568_pdata) {
 		rk_priv = devm_kzalloc(&pdev->dev, sizeof(struct rk3568_priv), GFP_KERNEL);
-		if (!rk_priv)
+		if (!rk_priv) {
+			err = -ENOMEM;
 			goto err_clk;
+		}
 
 		priv->priv = rk_priv;
 
#1 lore raw
Quoted 9 lines · On Tue, 23 Mar 2021 at 12:20, 'w00385741 <[email protected]> wrote:

From: Wei Yongjun <[email protected]>

Fix to return negative error code -ENOMEM from the error handling case instead of 0, as done elsewhere in this function.

Fixes c2c4da37837e ("mmc: sdhci-of-dwcmshc: add rockchip platform support")

Applied for next, thanks!

Kind regards
Uffe

Quoted 21 lines
---
 drivers/mmc/host/sdhci-of-dwcmshc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-of-dwcmshc.c +3 -1
index 06873686d5e9..e96c628aeeeb 100644
@@ -383,8 +383,10 @@ static int dwcmshc_probe(struct platform_device *pdev)
 
        if (pltfm_data == &sdhci_dwcmshc_rk3568_pdata) {
                rk_priv = devm_kzalloc(&pdev->dev, sizeof(struct rk3568_priv), GFP_KERNEL);
-               if (!rk_priv)
+               if (!rk_priv) {
+                       err = -ENOMEM;
                        goto err_clk;
+               }
 
                priv->priv = rk_priv;