]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: dsa: don't use bitmap_weight() in b53_arl_read()
authorYury Norov <yury.norov@gmail.com>
Sun, 23 Jan 2022 18:38:32 +0000 (10:38 -0800)
committerYury Norov <yury.norov@gmail.com>
Mon, 2 May 2022 13:30:39 +0000 (06:30 -0700)
Don't call bitmap_weight() if the following code can get by
without it.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
drivers/net/dsa/b53/b53_common.c

index 77501f9c59159e4ad3870ba7b2cd9ef14108dc93..77643493120c80832775423ba1ce0d6c690fcaf5 100644 (file)
@@ -1624,12 +1624,8 @@ static int b53_arl_read(struct b53_device *dev, u64 mac,
                return 0;
        }
 
-       if (bitmap_weight(free_bins, dev->num_arl_bins) == 0)
-               return -ENOSPC;
-
        *idx = find_first_bit(free_bins, dev->num_arl_bins);
-
-       return -ENOENT;
+       return *idx >= dev->num_arl_bins ? -ENOSPC : -ENOENT;
 }
 
 static int b53_arl_op(struct b53_device *dev, int op, int port,