From: Yong Wu Date: Tue, 14 Sep 2021 11:36:56 +0000 (+0800) Subject: memory: mtk-smi: Add error handle for smi_probe X-Git-Tag: microblaze-v5.18~600^2~21^2~7 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=30b869e77a1c626190bbbe6b4e5f5382b0102ac3;p=linux-2.6-microblaze.git memory: mtk-smi: Add error handle for smi_probe Add error handle while component_add fail. Signed-off-by: Yong Wu Reviewed-by: Ikjoon Jang Link: https://lore.kernel.org/r/20210914113703.31466-7-yong.wu@mediatek.com Fixes: 6ce2c05b2118 ("memory: mtk-smi: Add device-link between smi-larb and smi-common") Signed-off-by: Krzysztof Kozlowski --- diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 33b6c5efe102..b362d528944e 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -338,7 +338,15 @@ static int mtk_smi_larb_probe(struct platform_device *pdev) pm_runtime_enable(dev); platform_set_drvdata(pdev, larb); - return component_add(dev, &mtk_smi_larb_component_ops); + ret = component_add(dev, &mtk_smi_larb_component_ops); + if (ret) + goto err_pm_disable; + return 0; + +err_pm_disable: + pm_runtime_disable(dev); + device_link_remove(dev, larb->smi_common_dev); + return ret; } static int mtk_smi_larb_remove(struct platform_device *pdev)