Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330886
b: refs/heads/master
c: d1bb4b2
h: refs/heads/master
v: v3
  • Loading branch information
Julia Lawall authored and Mauro Carvalho Chehab committed Aug 15, 2012
1 parent d8a3255 commit 8d71ef2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 071408b6dcc1cb29150699621e13b0ddb81e3cf1
refs/heads/master: d1bb4b29a74ea81b8282011479bc36417620b5fa
31 changes: 12 additions & 19 deletions trunk/drivers/media/platform/mx2_emmaprp.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,35 +896,32 @@ static int emmaprp_probe(struct platform_device *pdev)
int irq_emma;
int ret;

pcdev = kzalloc(sizeof *pcdev, GFP_KERNEL);
pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL);
if (!pcdev)
return -ENOMEM;

spin_lock_init(&pcdev->irqlock);

pcdev->clk_emma_ipg = devm_clk_get(&pdev->dev, "ipg");
if (IS_ERR(pcdev->clk_emma_ipg)) {
ret = PTR_ERR(pcdev->clk_emma_ipg);
goto free_dev;
return PTR_ERR(pcdev->clk_emma_ipg);
}

pcdev->clk_emma_ahb = devm_clk_get(&pdev->dev, "ahb");
if (IS_ERR(pcdev->clk_emma_ipg)) {
ret = PTR_ERR(pcdev->clk_emma_ahb);
goto free_dev;
return PTR_ERR(pcdev->clk_emma_ahb);
}

irq_emma = platform_get_irq(pdev, 0);
res_emma = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (irq_emma < 0 || res_emma == NULL) {
dev_err(&pdev->dev, "Missing platform resources data\n");
ret = -ENODEV;
goto free_dev;
return -ENODEV;
}

ret = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev);
if (ret)
goto free_dev;
return ret;

mutex_init(&pcdev->dev_mutex);

Expand All @@ -946,21 +943,20 @@ static int emmaprp_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, pcdev);

if (devm_request_mem_region(&pdev->dev, res_emma->start,
resource_size(res_emma), MEM2MEM_NAME) == NULL)
goto rel_vdev;

pcdev->base_emma = devm_ioremap(&pdev->dev, res_emma->start,
resource_size(res_emma));
if (!pcdev->base_emma)
pcdev->base_emma = devm_request_and_ioremap(&pdev->dev, res_emma);
if (!pcdev->base_emma) {
ret = -ENXIO;
goto rel_vdev;
}

pcdev->irq_emma = irq_emma;
pcdev->res_emma = res_emma;

if (devm_request_irq(&pdev->dev, pcdev->irq_emma, emmaprp_irq,
0, MEM2MEM_NAME, pcdev) < 0)
0, MEM2MEM_NAME, pcdev) < 0) {
ret = -ENODEV;
goto rel_vdev;
}

pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
if (IS_ERR(pcdev->alloc_ctx)) {
Expand Down Expand Up @@ -993,8 +989,6 @@ static int emmaprp_probe(struct platform_device *pdev)
video_device_release(vfd);
unreg_dev:
v4l2_device_unregister(&pcdev->v4l2_dev);
free_dev:
kfree(pcdev);

return ret;
}
Expand All @@ -1009,7 +1003,6 @@ static int emmaprp_remove(struct platform_device *pdev)
v4l2_m2m_release(pcdev->m2m_dev);
vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx);
v4l2_device_unregister(&pcdev->v4l2_dev);
kfree(pcdev);

return 0;
}
Expand Down

0 comments on commit 8d71ef2

Please sign in to comment.