Skip to contentSkip to conversation

hdpvr: Fixes probing function.

PATCH New Perceval Anichini 1 participant 1 message Jun 2, 2010 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hdpvr: Fixes probing function.

Hello everyone,

The error handling part of the hdpvr_probe () function wasn't properly destroying the workqueue created at the top of the function.

This patch fixes this bug.

Best regards,

Perceval.

From: Perceval Anichini <[email protected]>

In the hdpvr_probe () function, when an error occurs while probing the device, the workqueue created by the create_single_thread () call is not properly destroyed.

---

linux/drivers/media/video/hdpvr/hdpvr-core.c +5 -0
diff -r 304cfde05b3f linux/drivers/media/video/hdpvr/hdpvr-core.c
@@ -286,6 +286,8 @@
 		goto error;
 	}
 
+	dev->workqueue = 0;
+
 	/* register v4l2_device early so it can be used for printks */
 	if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) {
 		err("v4l2_device_register failed");
@@ -380,6 +382,9 @@
 
 error:
 	if (dev) {
+		/* Destroy single thread */
+		if (dev->workqueue)
+			destroy_workqueue(dev->workqueue);
 		/* this frees allocated memory */
 		hdpvr_delete(dev);
 	}