[media] coda: Call v4l2_device_unregister() from a single location
Instead of calling v4l2_device_unregister() in multiple locations within the error paths, let's call it from a single location to make the error handling simpler. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
ed3da2bf2e
commit
b7bd660a51
1 changed files with 12 additions and 8 deletions
|
@ -2035,12 +2035,14 @@ static int coda_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
pdev_id = of_id ? of_id->data : platform_get_device_id(pdev);
|
pdev_id = of_id ? of_id->data : platform_get_device_id(pdev);
|
||||||
|
|
||||||
if (of_id)
|
if (of_id) {
|
||||||
dev->devtype = of_id->data;
|
dev->devtype = of_id->data;
|
||||||
else if (pdev_id)
|
} else if (pdev_id) {
|
||||||
dev->devtype = &coda_devdata[pdev_id->driver_data];
|
dev->devtype = &coda_devdata[pdev_id->driver_data];
|
||||||
else
|
} else {
|
||||||
return -EINVAL;
|
ret = -EINVAL;
|
||||||
|
goto err_v4l2_register;
|
||||||
|
}
|
||||||
|
|
||||||
spin_lock_init(&dev->irqlock);
|
spin_lock_init(&dev->irqlock);
|
||||||
INIT_LIST_HEAD(&dev->instances);
|
INIT_LIST_HEAD(&dev->instances);
|
||||||
|
@ -2120,8 +2122,7 @@ static int coda_probe(struct platform_device *pdev)
|
||||||
dev->debugfs_root);
|
dev->debugfs_root);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&pdev->dev, "failed to allocate work buffer\n");
|
dev_err(&pdev->dev, "failed to allocate work buffer\n");
|
||||||
v4l2_device_unregister(&dev->v4l2_dev);
|
goto err_v4l2_register;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2131,8 +2132,7 @@ static int coda_probe(struct platform_device *pdev)
|
||||||
dev->debugfs_root);
|
dev->debugfs_root);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&pdev->dev, "failed to allocate temp buffer\n");
|
dev_err(&pdev->dev, "failed to allocate temp buffer\n");
|
||||||
v4l2_device_unregister(&dev->v4l2_dev);
|
goto err_v4l2_register;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2167,6 +2167,10 @@ static int coda_probe(struct platform_device *pdev)
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
|
|
||||||
return coda_firmware_request(dev);
|
return coda_firmware_request(dev);
|
||||||
|
|
||||||
|
err_v4l2_register:
|
||||||
|
v4l2_device_unregister(&dev->v4l2_dev);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int coda_remove(struct platform_device *pdev)
|
static int coda_remove(struct platform_device *pdev)
|
||||||
|
|
Loading…
Add table
Reference in a new issue