Commit 6ff02276 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

media: rkisp1: Simplify rkisp1_entities_register() error path

Now that all the unregistration functions are safe to call on
non-registered entities, the error path in rkisp1_entities_register()
can be simplified. Factor out the unregistration to a separate function
to share code with rkisp1_remove().
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarDafna Hirschfeld <dafna@fastmail.com>
Reviewed-by: default avatarRicardo Ribalda <ribalda@chromium.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 6adceb70
......@@ -346,48 +346,50 @@ static const struct dev_pm_ops rkisp1_pm_ops = {
* Core
*/
static void rkisp1_entities_unregister(struct rkisp1_device *rkisp1)
{
rkisp1_params_unregister(rkisp1);
rkisp1_stats_unregister(rkisp1);
rkisp1_capture_devs_unregister(rkisp1);
rkisp1_resizer_devs_unregister(rkisp1);
rkisp1_isp_unregister(rkisp1);
}
static int rkisp1_entities_register(struct rkisp1_device *rkisp1)
{
int ret;
ret = rkisp1_isp_register(rkisp1);
if (ret)
return ret;
goto error;
ret = rkisp1_resizer_devs_register(rkisp1);
if (ret)
goto err_unreg_isp_subdev;
goto error;
ret = rkisp1_capture_devs_register(rkisp1);
if (ret)
goto err_unreg_resizer_devs;
goto error;
ret = rkisp1_stats_register(rkisp1);
if (ret)
goto err_unreg_capture_devs;
goto error;
ret = rkisp1_params_register(rkisp1);
if (ret)
goto err_unreg_stats;
goto error;
ret = rkisp1_subdev_notifier(rkisp1);
if (ret) {
dev_err(rkisp1->dev,
"Failed to register subdev notifier(%d)\n", ret);
goto err_unreg_params;
goto error;
}
return 0;
err_unreg_params:
rkisp1_params_unregister(rkisp1);
err_unreg_stats:
rkisp1_stats_unregister(rkisp1);
err_unreg_capture_devs:
rkisp1_capture_devs_unregister(rkisp1);
err_unreg_resizer_devs:
rkisp1_resizer_devs_unregister(rkisp1);
err_unreg_isp_subdev:
rkisp1_isp_unregister(rkisp1);
error:
rkisp1_entities_unregister(rkisp1);
return ret;
}
......@@ -583,11 +585,7 @@ static int rkisp1_remove(struct platform_device *pdev)
v4l2_async_nf_unregister(&rkisp1->notifier);
v4l2_async_nf_cleanup(&rkisp1->notifier);
rkisp1_params_unregister(rkisp1);
rkisp1_stats_unregister(rkisp1);
rkisp1_capture_devs_unregister(rkisp1);
rkisp1_resizer_devs_unregister(rkisp1);
rkisp1_isp_unregister(rkisp1);
rkisp1_entities_unregister(rkisp1);
media_device_unregister(&rkisp1->media_dev);
v4l2_device_unregister(&rkisp1->v4l2_dev);
......
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