diff mbox series

[v2,06/11] memory: mtk-smi: Add error handle for smi_probe

Message ID 20210715121209.31024-7-yong.wu@mediatek.com
State Superseded
Headers show
Series MT8195 SMI support | expand

Commit Message

Yong Wu (吴勇) July 15, 2021, 12:12 p.m. UTC
Add error handle while component_add fail.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
---
It don't have the error handle when v1. it is not a fatal error.
thus don't add fix tags.
---
 drivers/memory/mtk-smi.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Ikjoon Jang July 21, 2021, 10:45 a.m. UTC | #1
On Thu, Jul 15, 2021 at 8:23 PM Yong Wu <yong.wu@mediatek.com> wrote:
>

> Add error handle while component_add fail.

>

> Signed-off-by: Yong Wu <yong.wu@mediatek.com>


Reviewed-by: Ikjoon Jang <ikjn@chromium.org>


> ---

> It don't have the error handle when v1. it is not a fatal error.

> thus don't add fix tags.

> ---

>  drivers/memory/mtk-smi.c | 10 +++++++++-

>  1 file changed, 9 insertions(+), 1 deletion(-)

>

> diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c

> index 6f8e582bace5..e68cbb51dd12 100644

> --- a/drivers/memory/mtk-smi.c

> +++ b/drivers/memory/mtk-smi.c

> @@ -330,7 +330,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)

> --

> 2.18.0

> _______________________________________________

> Linux-mediatek mailing list

> Linux-mediatek@lists.infradead.org

> http://lists.infradead.org/mailman/listinfo/linux-mediatek
diff mbox series

Patch

diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index 6f8e582bace5..e68cbb51dd12 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -330,7 +330,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)