Commit e4fac74d authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Mauro Carvalho Chehab

[media] s5p-mfc: fix error path in driver probe

This patch fixes the error path in the driver probe, so in case of
any failure, the resources are not leaked.
Reported-by: default avatarLiviu Dudau <liviu.dudau@arm.com>
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Acked-by: default avatarLiviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: default avatarKamil Debski <k.debski@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent b16a2d87
...@@ -1159,7 +1159,10 @@ static int s5p_mfc_probe(struct platform_device *pdev) ...@@ -1159,7 +1159,10 @@ static int s5p_mfc_probe(struct platform_device *pdev)
dev->variant = mfc_get_drv_data(pdev); dev->variant = mfc_get_drv_data(pdev);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
dev_err(&pdev->dev, "failed to get io resource\n");
return -ENOENT;
}
dev->regs_base = devm_ioremap_resource(&pdev->dev, res); dev->regs_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(dev->regs_base)) if (IS_ERR(dev->regs_base))
return PTR_ERR(dev->regs_base); return PTR_ERR(dev->regs_base);
...@@ -1167,15 +1170,14 @@ static int s5p_mfc_probe(struct platform_device *pdev) ...@@ -1167,15 +1170,14 @@ static int s5p_mfc_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res == NULL) { if (res == NULL) {
dev_err(&pdev->dev, "failed to get irq resource\n"); dev_err(&pdev->dev, "failed to get irq resource\n");
ret = -ENOENT; return -ENOENT;
goto err_res;
} }
dev->irq = res->start; dev->irq = res->start;
ret = devm_request_irq(&pdev->dev, dev->irq, s5p_mfc_irq, ret = devm_request_irq(&pdev->dev, dev->irq, s5p_mfc_irq,
0, pdev->name, dev); 0, pdev->name, dev);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Failed to install irq (%d)\n", ret); dev_err(&pdev->dev, "Failed to install irq (%d)\n", ret);
goto err_res; return ret;
} }
ret = s5p_mfc_configure_dma_memory(dev); ret = s5p_mfc_configure_dma_memory(dev);
...@@ -1187,7 +1189,7 @@ static int s5p_mfc_probe(struct platform_device *pdev) ...@@ -1187,7 +1189,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)
ret = s5p_mfc_init_pm(dev); ret = s5p_mfc_init_pm(dev);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "failed to get mfc clock source\n"); dev_err(&pdev->dev, "failed to get mfc clock source\n");
return ret; goto err_dma;
} }
vb2_dma_contig_set_max_seg_size(dev->mem_dev_l, DMA_BIT_MASK(32)); vb2_dma_contig_set_max_seg_size(dev->mem_dev_l, DMA_BIT_MASK(32));
...@@ -1299,6 +1301,8 @@ static int s5p_mfc_probe(struct platform_device *pdev) ...@@ -1299,6 +1301,8 @@ static int s5p_mfc_probe(struct platform_device *pdev)
vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[0]); vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[0]);
err_res: err_res:
s5p_mfc_final_pm(dev); s5p_mfc_final_pm(dev);
err_dma:
s5p_mfc_unconfigure_dma_memory(dev);
pr_debug("%s-- with error\n", __func__); pr_debug("%s-- with error\n", __func__);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment