[source] ledtrig-usbdev: fix duplicate match detection

LEDE Commits lede-commits at lists.infradead.org
Sat Jul 23 01:30:53 PDT 2016


nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/?p=source.git;a=commitdiff;h=8fb89f7e73f29fb8bc94430ef024c19807a0c1d3

commit 8fb89f7e73f29fb8bc94430ef024c19807a0c1d3
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Sat Jul 23 10:29:55 2016 +0200

    ledtrig-usbdev: fix duplicate match detection
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 target/linux/generic/files/drivers/leds/ledtrig-usbdev.c | 9 +++++----
 1 file 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 effcae6..2524bce 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;
 }



More information about the lede-commits mailing list