]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: platform: allgro-dvt: unregister v4l2_device on the error path
authorJoe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Thu, 5 Dec 2024 02:06:21 +0000 (11:06 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:31:58 +0000 (14:31 +0200)
[ Upstream commit c2b96a6818159fba8a3bcc38262da9e77f9b3ec7 ]

In allegro_probe(), the v4l2 device is not unregistered in the error
path, which results in a memory leak. Fix it by calling
v4l2_device_unregister() before returning error.

Fixes: d74d4e2359ec ("media: allegro: move driver out of staging")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Reviewed-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/allegro-dvt/allegro-core.c

index 881c5bbf61568c2bf3f091958e6f59418e9e1bb9..f472eb19cd92f9799dfe2ec1c18c211ec4ed1f29 100644 (file)
@@ -3740,6 +3740,7 @@ static int allegro_probe(struct platform_device *pdev)
        if (ret < 0) {
                v4l2_err(&dev->v4l2_dev,
                         "failed to request firmware: %d\n", ret);
+               v4l2_device_unregister(&dev->v4l2_dev);
                return ret;
        }