Skip to contentSkip to conversation

rio500: refuse more than one device at a time

PATCH Superseded Oliver Neukum 1 participant 1 message Apr 30, 2019 USB

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 rio500: refuse more than one device at a time

This driver is using a global variable. It cannot handle more than one device at a time. The issue has been exisying since the dawn of the driver.

---
 drivers/usb/misc/rio500.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/misc/rio500.c +6 -1
index 13e4889bc34f..a4b6fbea975f 100644
@@ -449,7 +449,12 @@ static int probe_rio(struct usb_interface *intf,
 	struct rio_usb_data *rio = &rio_instance;
 	int retval;
 
-	dev_info(&intf->dev, "USB Rio found at address %d\n", dev->devnum);
+	if (rio->present) {
+		dev_info(&intf->dev, "Second USB Rio at address %d refused\n", dev->devnum);
+		return -EBUSY;
+	} else {
+		dev_info(&intf->dev, "USB Rio found at address %d\n", dev->devnum);
+	}
 
 	retval = usb_register_dev(intf, &usb_rio_class);
 	if (retval) {