]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: radio-si476x: Unregister v4l2_device on probe failure
authorMyeonghun Pak <mhun512@gmail.com>
Wed, 13 May 2026 07:02:37 +0000 (16:02 +0900)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Wed, 20 May 2026 06:58:05 +0000 (08:58 +0200)
si476x_radio_probe() registers radio->v4l2dev before allocating the V4L2
controls and before registering the video device. If any of those later
steps fails, probe returns through the exit label after freeing only the
control handler.

A failed probe does not call si476x_radio_remove(), so the
v4l2_device_unregister() there is not reached. This leaves the parent
device reference taken by v4l2_device_register() behind on the error path.

Unregister the V4L2 device in the probe error path after freeing the
controls.

Fixes: b879a9c2a755 ("[media] v4l2: Add a V4L2 driver for SI476X MFD")
Cc: stable@vger.kernel.org
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/radio/radio-si476x.c

index 9980346cb5ea3897e515a0042cdb6c7b24334b01..bfe89782dce4389e27504519bea2d21c3ea73f6c 100644 (file)
@@ -1493,6 +1493,7 @@ static int si476x_radio_probe(struct platform_device *pdev)
        return 0;
 exit:
        v4l2_ctrl_handler_free(radio->videodev.ctrl_handler);
+       v4l2_device_unregister(&radio->v4l2dev);
        return rval;
 }