Skip to content

Commit

Permalink
media: davinci: vpif: fix unbalanced runtime PM enable
Browse files Browse the repository at this point in the history
Make sure to disable runtime PM before returning on probe errors.

Fixes: 479f7a1 ("[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>
  • Loading branch information
Johan Hovold authored and Mauro Carvalho Chehab committed Jan 23, 2022
1 parent 4a321de commit d42b3ad
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions drivers/media/platform/davinci/vpif.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ static int vpif_probe(struct platform_device *pdev)
static struct resource *res_irq;
struct platform_device *pdev_capture, *pdev_display;
struct device_node *endpoint = NULL;
int ret;

vpif_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(vpif_base))
Expand Down Expand Up @@ -456,8 +457,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),
Expand Down Expand Up @@ -491,6 +492,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)
Expand Down

0 comments on commit d42b3ad

Please sign in to comment.