diff options
author | Yury Norov <yury.norov@gmail.com> | 2022-01-23 10:38:32 -0800 |
---|---|---|
committer | Yury Norov <yury.norov@gmail.com> | 2022-05-02 06:30:39 -0700 |
commit | e18e5cbc70f17029c3d028ee701cecc45b7618b4 (patch) | |
tree | aac959b097eeb40e3f314c8c5a93d0ce36ae4295 /drivers/net/dsa | |
parent | ce522ba9ef7e2d9fb22a39eb3371c0c64e2a433e (diff) |
net: dsa: don't use bitmap_weight() in b53_arl_read()
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>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r-- | drivers/net/dsa/b53/b53_common.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index 77501f9c5915..77643493120c 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -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, |