Remove the unnecessary 'ret' variable and return the matching amba_id
entry directly when the condition is met. This makes the code shorter
and more readable without changing any functional behavior.

Signed-off-by: Alexander Shiyan <[email protected]>
---
 drivers/amba/bus.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 2ac3c0bc29..4a9ab09714 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -17,16 +17,13 @@
 static const struct amba_id *
 amba_lookup(const struct amba_id *table, struct amba_device *dev)
 {
-       int ret = 0;
-
        while (table->mask) {
-               ret = (dev->periphid & table->mask) == table->id;
-               if (ret)
-                       break;
+               if (dev->periphid & table->mask == table->id)
+                       return table;
                table++;
        }
 
-       return ret ? table : NULL;
+       return NULL;
 }
 
 static int amba_match(struct device *dev, const struct driver *drv)
-- 
2.52.0


Reply via email to