]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: mmp: Bring back registration of the device
authorLubomir Rintel <lkundrak@v3.sk>
Tue, 31 Dec 2024 19:04:34 +0000 (20:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Feb 2025 09:05:33 +0000 (10:05 +0100)
commit fbb5298bf1a7b71723cd2bb193642429ceb0fb84 upstream.

In commit 4af65141e38e ("media: marvell: cafe: Register V4L2 device
earlier"), a call to v4l2_device_register() was moved away from
mccic_register() into its caller, marvell/cafe's cafe_pci_probe().
This is not the only caller though -- there's also marvell/mmp.

Add v4l2_device_register() into mmpcam_probe() to unbreak the MMP camera
driver, in a fashion analogous to what's been done to the Cafe driver.
Same for the teardown path.

Fixes: 4af65141e38e ("media: marvell: cafe: Register V4L2 device earlier")
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Cc: stable@vger.kernel.org # v6.6+
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/platform/marvell/mmp-driver.c

index ff9d151121d5eb3437f9dc07dd6fee7b1116b7c9..4fa171d469cabc4468f7ff26732eca7460c0c718 100644 (file)
@@ -231,13 +231,23 @@ static int mmpcam_probe(struct platform_device *pdev)
 
        mcam_init_clk(mcam);
 
+       /*
+        * Register with V4L.
+        */
+
+       ret = v4l2_device_register(mcam->dev, &mcam->v4l2_dev);
+       if (ret)
+               return ret;
+
        /*
         * Create a match of the sensor against its OF node.
         */
        ep = fwnode_graph_get_next_endpoint(of_fwnode_handle(pdev->dev.of_node),
                                            NULL);
-       if (!ep)
-               return -ENODEV;
+       if (!ep) {
+               ret = -ENODEV;
+               goto out_v4l2_device_unregister;
+       }
 
        v4l2_async_nf_init(&mcam->notifier, &mcam->v4l2_dev);
 
@@ -246,7 +256,7 @@ static int mmpcam_probe(struct platform_device *pdev)
        fwnode_handle_put(ep);
        if (IS_ERR(asd)) {
                ret = PTR_ERR(asd);
-               goto out;
+               goto out_v4l2_device_unregister;
        }
 
        /*
@@ -254,7 +264,7 @@ static int mmpcam_probe(struct platform_device *pdev)
         */
        ret = mccic_register(mcam);
        if (ret)
-               goto out;
+               goto out_v4l2_device_unregister;
 
        /*
         * Add OF clock provider.
@@ -283,6 +293,8 @@ static int mmpcam_probe(struct platform_device *pdev)
        return 0;
 out:
        mccic_shutdown(mcam);
+out_v4l2_device_unregister:
+       v4l2_device_unregister(&mcam->v4l2_dev);
 
        return ret;
 }
@@ -293,6 +305,7 @@ static void mmpcam_remove(struct platform_device *pdev)
        struct mcam_camera *mcam = &cam->mcam;
 
        mccic_shutdown(mcam);
+       v4l2_device_unregister(&mcam->v4l2_dev);
        pm_runtime_force_suspend(mcam->dev);
 }