aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-09-05 07:25:26 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-10-06 08:12:36 -0400
commit02249369352879343337ee63b45dee1e1cfc2550 (patch)
treec0a604fe6324f740dd3716b81838ed08175a4eff /drivers/media
parentec0341b3b7817a5e8ebcf26091dde28dce2d7821 (diff)
[media] soc_camera: Use devm_kzalloc function
devm_kzalloc() has been used to simplify error handling. While at it, the soc_camera_device_register function has been moved to save a few lines of code and a variable. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> [g.liakhovetski@gmx.de: remove a superfluous empty line] Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/soc_camera/soc_camera.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index 1234767a55bc..96c3c6e83cc0 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1529,12 +1529,11 @@ static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev)
1529{ 1529{
1530 struct soc_camera_link *icl = pdev->dev.platform_data; 1530 struct soc_camera_link *icl = pdev->dev.platform_data;
1531 struct soc_camera_device *icd; 1531 struct soc_camera_device *icd;
1532 int ret;
1533 1532
1534 if (!icl) 1533 if (!icl)
1535 return -EINVAL; 1534 return -EINVAL;
1536 1535
1537 icd = kzalloc(sizeof(*icd), GFP_KERNEL); 1536 icd = devm_kzalloc(&pdev->dev, sizeof(*icd), GFP_KERNEL);
1538 if (!icd) 1537 if (!icd)
1539 return -ENOMEM; 1538 return -ENOMEM;
1540 1539
@@ -1543,19 +1542,10 @@ static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev)
1543 icd->pdev = &pdev->dev; 1542 icd->pdev = &pdev->dev;
1544 platform_set_drvdata(pdev, icd); 1543 platform_set_drvdata(pdev, icd);
1545 1544
1546 ret = soc_camera_device_register(icd);
1547 if (ret < 0)
1548 goto escdevreg;
1549
1550 icd->user_width = DEFAULT_WIDTH; 1545 icd->user_width = DEFAULT_WIDTH;
1551 icd->user_height = DEFAULT_HEIGHT; 1546 icd->user_height = DEFAULT_HEIGHT;
1552 1547
1553 return 0; 1548 return soc_camera_device_register(icd);
1554
1555escdevreg:
1556 kfree(icd);
1557
1558 return ret;
1559} 1549}
1560 1550
1561/* 1551/*
@@ -1572,8 +1562,6 @@ static int __devexit soc_camera_pdrv_remove(struct platform_device *pdev)
1572 1562
1573 list_del(&icd->list); 1563 list_del(&icd->list);
1574 1564
1575 kfree(icd);
1576
1577 return 0; 1565 return 0;
1578} 1566}
1579 1567