Skip to content

Commit 30b2953

Browse files
trashseeJiri Kosina
authored andcommitted
media: radio-ma901: return ENODEV in probe if usb_device doesn't match
Masterkit MA901 usb radio device shares USB ID with Atmel V-USB devices. This patch adds additional checks in usb_ma901radio_probe() and if product or manufacturer doesn't match we return -ENODEV and don't continue. This allows hid drivers to handle not MA901 device. Signed-off-by: Alexey Klimov <[email protected]> Acked-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 5b4617d commit 30b2953

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/media/radio/radio-ma901.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,20 @@ static void usb_ma901radio_release(struct v4l2_device *v4l2_dev)
347347
static int usb_ma901radio_probe(struct usb_interface *intf,
348348
const struct usb_device_id *id)
349349
{
350+
struct usb_device *dev = interface_to_usbdev(intf);
350351
struct ma901radio_device *radio;
351352
int retval = 0;
352353

354+
/* Masterkit MA901 usb radio has the same USB ID as many others
355+
* Atmel V-USB devices. Let's make additional checks to be sure
356+
* that this is our device.
357+
*/
358+
359+
if (dev->product && dev->manufacturer &&
360+
(strncmp(dev->product, "MA901", 5) != 0
361+
|| strncmp(dev->manufacturer, "www.masterkit.ru", 16) != 0))
362+
return -ENODEV;
363+
353364
radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL);
354365
if (!radio) {
355366
dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n");

0 commit comments

Comments
 (0)