Skip to contentSkip to conversation

drivers/amba/bus.c: Don't perform extra matching when any one fails

PATCH New Kautuk Consul 1 participant 1 message Sep 1, 2011 Arm primecell bus support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/amba/bus.c: Don't perform extra matching when any one fails

If any one operation fails, then r anyways gets set to 0, which will cause the device to not match the find_data.

---
 drivers/amba/bus.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/amba/bus.c +6 -4
index d74926e..af2e0a1 100644
@@ -699,10 +699,12 @@ static int amba_find_match(struct device *dev, void *data)
 	int r;
 
 	r = (pcdev->periphid & d->mask) == d->id;
-	if (d->parent)
-		r &= d->parent == dev->parent;
-	if (d->busid)
-		r &= strcmp(dev_name(dev), d->busid) == 0;
+	if (r) {
+		if (d->parent)
+			r &= d->parent == dev->parent;
+		if (r && d->busid)
+			r &= strcmp(dev_name(dev), d->busid) == 0;
+	}
 
 	if (r) {
 		get_device(dev);
Signature · 1 line
1.7.4.1