OSDN Git Service

octeontx2-af: Fix a potentially spurious error message
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 25 Nov 2022 12:23:57 +0000 (13:23 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 1 Dec 2022 04:42:19 +0000 (20:42 -0800)
When this error message is displayed, we know that the all the bits in the
bitmap are set.

So, bitmap_weight() will return the number of bits of the bitmap, which is
'table->tot_ids'.

It is unlikely that a bit will be cleared between mutex_unlock() and
dev_err(), but, in order to simplify the code and avoid this possibility,
just take 'table->tot_ids'.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/5ce01c402f86412dc57884ff0994b63f0c5b3871.1669378798.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c

index 5940290..5e6c545 100644 (file)
@@ -490,7 +490,7 @@ static bool rvu_npc_exact_alloc_id(struct rvu *rvu, u32 *seq_id)
        if (idx == table->tot_ids) {
                mutex_unlock(&table->lock);
                dev_err(rvu->dev, "%s: No space in id bitmap (%d)\n",
-                       __func__, bitmap_weight(table->id_bmap, table->tot_ids));
+                       __func__, table->tot_ids);
 
                return false;
        }