Skip to contentSkip to conversation

media: radio-maxiradio: balance PCI device enable on cleanup

PATCH Superseded Myeonghun Pak 1 participant 1 message Sep 15

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: radio-maxiradio: balance PCI device enable on cleanup

The tuner initialization failure and remove paths omit the matching pci_disable_device() after a successful pci_enable_device(). Disable the device on both paths, after the final hardware access on removal.

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

---

drivers/media/radio/radio-maxiradio.c +4 -1
@@ -159,10 +159,12 @@
 	dev->io = pci_resource_start(pdev, 0);
 	if (snd_tea575x_init(&dev->tea, THIS_MODULE)) {
 		printk(KERN_ERR "radio-maxiradio: Unable to detect TEA575x tuner\n");
-		goto err_out_free_region;
+		goto err_disable_device;
 	}
 	return 0;
 
+err_disable_device:
+	pci_disable_device(pdev);
 err_out_free_region:
 	release_region(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
 err_hdl:
@@ -180,6 +182,7 @@
 	snd_tea575x_exit(&dev->tea);
 	/* Turn off power */
 	outb(0, dev->io);
+	pci_disable_device(pdev);
 	v4l2_device_unregister(v4l2_dev);
 	release_region(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
 	kfree(dev);