@@ -2403,10 +2403,17 @@ static int vpfe_probe(struct platform_device *pdev)
vpfe->pdev = &pdev->dev;
+ ret = v4l2_device_register(&pdev->dev, &vpfe->v4l2_dev);
+ if (ret) {
+ vpfe_err(vpfe, "Unable to register v4l2 device.\n");
+ return ret;
+ }
+
vpfe_cfg = vpfe_get_pdata(vpfe);
if (!vpfe_cfg) {
dev_err(&pdev->dev, "No platform data\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto probe_out_cleanup;
}
vpfe->cfg = vpfe_cfg;
@@ -2433,13 +2440,6 @@ static int vpfe_probe(struct platform_device *pdev)
goto probe_out_cleanup;
}
- ret = v4l2_device_register(&pdev->dev, &vpfe->v4l2_dev);
- if (ret) {
- vpfe_err(vpfe,
- "Unable to register v4l2 device.\n");
- goto probe_out_cleanup;
- }
-
/* set the driver data in platform device */
platform_set_drvdata(pdev, vpfe);
/* Enabling module functional clock */
@@ -2449,7 +2449,7 @@ static int vpfe_probe(struct platform_device *pdev)
ret = pm_runtime_resume_and_get(&pdev->dev);
if (ret < 0) {
vpfe_err(vpfe, "Unable to resume device.\n");
- goto probe_out_v4l2_unregister;
+ goto probe_out_cleanup;
}
vpfe_ccdc_config_defaults(ccdc);
@@ -2462,7 +2462,7 @@ static int vpfe_probe(struct platform_device *pdev)
GFP_KERNEL);
if (!vpfe->sd) {
ret = -ENOMEM;
- goto probe_out_v4l2_unregister;
+ goto probe_out_cleanup;
}
vpfe->notifier.ops = &vpfe_async_ops;
@@ -2470,15 +2470,14 @@ static int vpfe_probe(struct platform_device *pdev)
if (ret) {
vpfe_err(vpfe, "Error registering async notifier\n");
ret = -EINVAL;
- goto probe_out_v4l2_unregister;
+ goto probe_out_cleanup;
}
return 0;
-probe_out_v4l2_unregister:
- v4l2_device_unregister(&vpfe->v4l2_dev);
probe_out_cleanup:
v4l2_async_nf_cleanup(&vpfe->notifier);
+ v4l2_device_unregister(&vpfe->v4l2_dev);
return ret;
}
@@ -2493,8 +2492,8 @@ static void vpfe_remove(struct platform_device *pdev)
v4l2_async_nf_unregister(&vpfe->notifier);
v4l2_async_nf_cleanup(&vpfe->notifier);
- v4l2_device_unregister(&vpfe->v4l2_dev);
video_unregister_device(&vpfe->video_dev);
+ v4l2_device_unregister(&vpfe->v4l2_dev);
}
#ifdef CONFIG_PM_SLEEP