diff mbox series

[1/5] octeontx2-af: Fix a potentially spurious error message

Message ID 5ce01c402f86412dc57884ff0994b63f0c5b3871.1669378798.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Accepted
Commit 2450d7d93fd2424dfacbf4aebf3fa8829df9d16e
Delegated to: Netdev Maintainers
Headers show
Series [1/5] octeontx2-af: Fix a potentially spurious error message | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter warning Series does not have a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Christophe JAILLET Nov. 25, 2022, 12:23 p.m. UTC
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>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Dec. 1, 2022, 4:50 a.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 25 Nov 2022 13:23:57 +0100 you wrote:
> 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'.
> 
> [...]

Here is the summary with links:
  - [1/5] octeontx2-af: Fix a potentially spurious error message
    https://git.kernel.org/netdev/net-next/c/2450d7d93fd2
  - [2/5] octeontx2-af: Slightly simplify rvu_npc_exact_init()
    https://git.kernel.org/netdev/net-next/c/b6a0ecaee2e6
  - [3/5] octeontx2-af: Use the bitmap API to allocate bitmaps
    https://git.kernel.org/netdev/net-next/c/05a7b52ee5e4
  - [4/5] octeontx2-af: Fix the size of memory allocated for the 'id_bmap' bitmap
    https://git.kernel.org/netdev/net-next/c/6d135d9e2b00
  - [5/5] octeontx2-af: Simplify a size computation in rvu_npc_exact_init()
    https://git.kernel.org/netdev/net-next/c/450f06505396

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
index 594029007f85..5e6c54577a97 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
@@ -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;
 	}