]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
media: stm32-dcmi: return appropriate error codes during probe
authorFabien Dessenne <fabien.dessenne@st.com>
Wed, 24 Apr 2019 13:25:44 +0000 (09:25 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 13 Aug 2019 12:11:36 +0000 (14:11 +0200)
BugLink: https://bugs.launchpad.net/bugs/1837517
[ Upstream commit b5b5a27bee5884860798ffd0f08e611a3942064b ]

During probe, return the provided errors value instead of -ENODEV.
This allows the driver to be deferred probed if needed.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Acked-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/media/platform/stm32/stm32-dcmi.c

index 6732874114cf7882cf6dc518046a716e470e1bcb..918e49f27c7ed8ac83ba99006256ec510cf0e870 100644 (file)
@@ -1645,7 +1645,7 @@ static int dcmi_probe(struct platform_device *pdev)
        dcmi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
        if (IS_ERR(dcmi->rstc)) {
                dev_err(&pdev->dev, "Could not get reset control\n");
-               return -ENODEV;
+               return PTR_ERR(dcmi->rstc);
        }
 
        /* Get bus characteristics from devicetree */
@@ -1660,7 +1660,7 @@ static int dcmi_probe(struct platform_device *pdev)
        of_node_put(np);
        if (ret) {
                dev_err(&pdev->dev, "Could not parse the endpoint\n");
-               return -ENODEV;
+               return ret;
        }
 
        if (ep.bus_type == V4L2_MBUS_CSI2_DPHY) {
@@ -1673,8 +1673,9 @@ static int dcmi_probe(struct platform_device *pdev)
 
        irq = platform_get_irq(pdev, 0);
        if (irq <= 0) {
-               dev_err(&pdev->dev, "Could not get irq\n");
-               return -ENODEV;
+               if (irq != -EPROBE_DEFER)
+                       dev_err(&pdev->dev, "Could not get irq\n");
+               return irq;
        }
 
        dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1694,12 +1695,13 @@ static int dcmi_probe(struct platform_device *pdev)
                                        dev_name(&pdev->dev), dcmi);
        if (ret) {
                dev_err(&pdev->dev, "Unable to request irq %d\n", irq);
-               return -ENODEV;
+               return ret;
        }
 
        mclk = devm_clk_get(&pdev->dev, "mclk");
        if (IS_ERR(mclk)) {
-               dev_err(&pdev->dev, "Unable to get mclk\n");
+               if (PTR_ERR(mclk) != -EPROBE_DEFER)
+                       dev_err(&pdev->dev, "Unable to get mclk\n");
                return PTR_ERR(mclk);
        }