diff options
author | Felix Fietkau <nbd@nbd.name> | 2016-07-23 10:29:55 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-07-23 10:30:45 +0200 |
commit | 8fb89f7e73f29fb8bc94430ef024c19807a0c1d3 (patch) | |
tree | a2f970a46130b98e5a3e375955661ba7fe8c0215 /target/linux/generic/files/drivers | |
parent | f1e085adfe53d11956aaa91fcc5d8eebb2ad0b7e (diff) | |
download | upstream-8fb89f7e73f29fb8bc94430ef024c19807a0c1d3.tar.gz upstream-8fb89f7e73f29fb8bc94430ef024c19807a0c1d3.tar.bz2 upstream-8fb89f7e73f29fb8bc94430ef024c19807a0c1d3.zip |
ledtrig-usbdev: fix duplicate match detection
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/generic/files/drivers')
-rw-r--r-- | target/linux/generic/files/drivers/leds/ledtrig-usbdev.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/target/linux/generic/files/drivers/leds/ledtrig-usbdev.c b/target/linux/generic/files/drivers/leds/ledtrig-usbdev.c index effcae6f9e..2524bce93b 100644 --- a/target/linux/generic/files/drivers/leds/ledtrig-usbdev.c +++ b/target/linux/generic/files/drivers/leds/ledtrig-usbdev.c @@ -92,13 +92,14 @@ static int usbdev_trig_find_usb_dev(struct usb_device *usb_dev, void *data) { struct usbdev_trig_match *match = data; + if (strcmp(dev_name(&usb_dev->dev), match->device_name) != 0) + return 0; + if (WARN_ON(match->usb_dev)) return 0; - if (!strcmp(dev_name(&usb_dev->dev), match->device_name)) { - dev_dbg(&usb_dev->dev, "matched this device!\n"); - match->usb_dev = usb_get_dev(usb_dev); - } + dev_dbg(&usb_dev->dev, "matched this device!\n"); + match->usb_dev = usb_get_dev(usb_dev); return 0; } |