Skip to contentSkip to conversation

anysee: initialize anysee_usb_mutex statically

PATCH New Akinobu Mita 1 participant 1 message Sep 13, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 anysee: initialize anysee_usb_mutex statically

anysee_usb_mutex is initialized at every time the anysee device is probed. If the second anysee device is probed while anysee_usb_mutex is locked by the first anysee device, the mutex is broken.

This patch fixes by initialize anysee_usb_mutex statically rather than initialize at probe time.

---
 drivers/media/dvb/dvb-usb/anysee.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/dvb/dvb-usb/anysee.c +1 -3
Index: 2.6-git/drivers/media/dvb/dvb-usb/anysee.c
===================================================================
@@ -43,7 +43,7 @@ module_param_named(debug, dvb_usb_anysee
 MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS);
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
-static struct mutex anysee_usb_mutex;
+static DEFINE_MUTEX(anysee_usb_mutex);
 
 static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen,
 	u8 *rbuf, u8 rlen)
@@ -436,8 +436,6 @@ static int anysee_probe(struct usb_inter
 	struct usb_host_interface *alt;
 	int ret;
 
-	mutex_init(&anysee_usb_mutex);
-
 	/* There is one interface with two alternate settings.
 	   Alternate setting 0 is for bulk transfer.
 	   Alternate setting 1 is for isochronous transfer.