]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: stm32: csi: register subdev only at end of probe
authorAlain Volmat <alain.volmat@foss.st.com>
Mon, 13 Jan 2025 08:57:54 +0000 (09:57 +0100)
committerHans Verkuil <hverkuil@xs4all.nl>
Sat, 15 Feb 2025 14:22:48 +0000 (15:22 +0100)
Call v4l2_async_register_subdev only whenever all initialization
are completed at the end of the probe function.
Remove as well useless err_free_priv label by returning directly
upon error.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/st/stm32/stm32-csi.c

index e2f63bb47d3319f5b4a621e67fa603fbf7027bd7..89fcd7d0790461a09726f779446e959cc442b4ef 100644 (file)
@@ -991,11 +991,11 @@ static int stm32_csi_probe(struct platform_device *pdev)
 
        ret = stm32_csi_get_resources(csidev, pdev);
        if (ret)
-               goto err_free_priv;
+               return ret;
 
        ret = stm32_csi_parse_dt(csidev);
        if (ret)
-               goto err_free_priv;
+               return ret;
 
        csidev->sd.owner = THIS_MODULE;
        csidev->sd.dev = &pdev->dev;
@@ -1020,10 +1020,6 @@ static int stm32_csi_probe(struct platform_device *pdev)
        if (ret < 0)
                goto err_cleanup;
 
-       ret = v4l2_async_register_subdev(&csidev->sd);
-       if (ret < 0)
-               goto err_cleanup;
-
        /* Reset device */
        rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
        if (IS_ERR(rstc)) {
@@ -1050,6 +1046,10 @@ static int stm32_csi_probe(struct platform_device *pdev)
 
        pm_runtime_enable(&pdev->dev);
 
+       ret = v4l2_async_register_subdev(&csidev->sd);
+       if (ret < 0)
+               goto err_cleanup;
+
        dev_info(&pdev->dev,
                 "Probed CSI with %u lanes\n", csidev->num_lanes);
 
@@ -1057,7 +1057,6 @@ static int stm32_csi_probe(struct platform_device *pdev)
 
 err_cleanup:
        v4l2_async_nf_cleanup(&csidev->notifier);
-err_free_priv:
        return ret;
 }