Skip to contentSkip to conversation

media: radio-sf16fmr2: unregister v4l2 device on tuner init failure

PATCH New Myeonghun Pak 1 participant 1 message Sep 15

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: radio-sf16fmr2: unregister v4l2 device on tuner init failure

When snd_tea575x_init() fails, fmr2_probe() releases the I/O region but leaves its v4l2_device registered. Unregister it before returning to the caller, which frees the containing fmr2 allocation.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes d4ecc83b79cc ("[media] tea575x-tuner: update to latest V4L2 framework requirements")
Assisted-by LLM

---

drivers/media/radio/radio-sf16fmr2.c +1 -0
@@ -241,6 +241,7 @@
 
 	if (snd_tea575x_init(&fmr2->tea, THIS_MODULE)) {
 		printk(KERN_ERR "radio-sf16fmr2: Unable to detect TEA575x tuner\n");
+		v4l2_device_unregister(&fmr2->v4l2_dev);
 		release_region(fmr2->io, 2);
 		return -ENODEV;
 	}