]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
media: davinci: vpif: fix unbalanced runtime PM enable
authorJohan Hovold <johan@kernel.org>
Wed, 22 Dec 2021 14:20:23 +0000 (15:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:39:58 +0000 (14:39 +0200)
commit d42b3ad105b5d3481f6a56bc789aa2b27aa09325 upstream.

Make sure to disable runtime PM before returning on probe errors.

Fixes: 479f7a118105 ("[media] davinci: vpif: adaptions for DT support")
Cc: stable@vger.kernel.org
Cc: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/platform/davinci/vpif.c

index ff96fc82b70c7329f9ac2b1512c4c30f8e0f4f9d..ee610daf90a3c9a93805cd7be44d4996d87e6cdf 100644 (file)
@@ -428,6 +428,7 @@ static int vpif_probe(struct platform_device *pdev)
        static struct resource  *res, *res_irq;
        struct platform_device *pdev_capture, *pdev_display;
        struct device_node *endpoint = NULL;
+       int ret;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        vpif_base = devm_ioremap_resource(&pdev->dev, res);
@@ -458,8 +459,8 @@ static int vpif_probe(struct platform_device *pdev)
        res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
        if (!res_irq) {
                dev_warn(&pdev->dev, "Missing IRQ resource.\n");
-               pm_runtime_put(&pdev->dev);
-               return -EINVAL;
+               ret = -EINVAL;
+               goto err_put_rpm;
        }
 
        pdev_capture = devm_kzalloc(&pdev->dev, sizeof(*pdev_capture),
@@ -493,6 +494,12 @@ static int vpif_probe(struct platform_device *pdev)
        }
 
        return 0;
+
+err_put_rpm:
+       pm_runtime_put(&pdev->dev);
+       pm_runtime_disable(&pdev->dev);
+
+       return ret;
 }
 
 static int vpif_remove(struct platform_device *pdev)