* [bug report] octeontx2-af: npc: cn20k: Use common APIs
@ 2026-04-10 5:52 Dan Carpenter
2026-04-10 9:52 ` Ratheesh Kannoth
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2026-04-10 5:52 UTC (permalink / raw)
To: Suman Ghosh; +Cc: Ratheesh Kannoth, Suman Ghosh, netdev
Hello Suman Ghosh,
Commit 6d1e70282f76 ("octeontx2-af: npc: cn20k: Use common APIs")
from Feb 24, 2026 (linux-next), leads to the following Smatch static
checker warning:
drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c:1065 npc_cn20k_config_mcam_entry()
error: uninitialized symbol 'kw_type'.
drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
1045 void npc_cn20k_config_mcam_entry(struct rvu *rvu, int blkaddr, int index,
1046 u8 intf, struct cn20k_mcam_entry *entry,
1047 bool enable, u8 hw_prio, u8 req_kw_type)
1048 {
1049 struct npc_mcam *mcam = &rvu->hw->mcam;
1050 int mcam_idx = index % mcam->banksize;
1051 int bank = index / mcam->banksize;
1052 int kw = 0;
1053 u8 kw_type;
1054
1055 /* Disable before mcam entry update */
1056 npc_cn20k_enable_mcam_entry(rvu, blkaddr, index, false);
1057
1058 npc_mcam_idx_2_key_type(rvu, index, &kw_type);
No error checking?
1059 /* CAM1 takes the comparison value and
1060 * CAM0 specifies match for a bit in key being '0' or '1' or 'dontcare'.
1061 * CAM1<n> = 0 & CAM0<n> = 1 => match if key<n> = 0
1062 * CAM1<n> = 1 & CAM0<n> = 0 => match if key<n> = 1
1063 * CAM1<n> = 0 & CAM0<n> = 0 => always match i.e dontcare.
1064 */
--> 1065 if (kw_type == NPC_MCAM_KEY_X2) {
^^^^^^^
Uninitialized
1066 /* Clear mcam entry to avoid writes being suppressed by NPC */
1067 npc_cn20k_clear_mcam_entry(rvu, blkaddr, bank, mcam_idx);
1068 npc_cn20k_config_kw_x2(rvu, mcam, blkaddr,
This email is a free service from the Smatch-CI project [smatch.sf.net].
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] octeontx2-af: npc: cn20k: Use common APIs
2026-04-10 5:52 [bug report] octeontx2-af: npc: cn20k: Use common APIs Dan Carpenter
@ 2026-04-10 9:52 ` Ratheesh Kannoth
0 siblings, 0 replies; 2+ messages in thread
From: Ratheesh Kannoth @ 2026-04-10 9:52 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Suman Ghosh, netdev
On 2026-04-10 at 11:22:38, Dan Carpenter (error27@gmail.com) wrote:
> Hello Suman Ghosh,
>
> Commit 6d1e70282f76 ("octeontx2-af: npc: cn20k: Use common APIs")
> from Feb 24, 2026 (linux-next), leads to the following Smatch static
> checker warning:
>
> drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c:1065 npc_cn20k_config_mcam_entry()
> error: uninitialized symbol 'kw_type'.
>
> drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> 1045 void npc_cn20k_config_mcam_entry(struct rvu *rvu, int blkaddr, int index,
> 1046 u8 intf, struct cn20k_mcam_entry *entry,
> 1047 bool enable, u8 hw_prio, u8 req_kw_type)
> 1048 {
> 1049 struct npc_mcam *mcam = &rvu->hw->mcam;
> 1050 int mcam_idx = index % mcam->banksize;
> 1051 int bank = index / mcam->banksize;
> 1052 int kw = 0;
> 1053 u8 kw_type;
> 1054
> 1055 /* Disable before mcam entry update */
> 1056 npc_cn20k_enable_mcam_entry(rvu, blkaddr, index, false);
> 1057
> 1058 npc_mcam_idx_2_key_type(rvu, index, &kw_type);
>
> No error checking?
ACK. will push
>
> 1059 /* CAM1 takes the comparison value and
> 1060 * CAM0 specifies match for a bit in key being '0' or '1' or 'dontcare'.
> 1061 * CAM1<n> = 0 & CAM0<n> = 1 => match if key<n> = 0
> 1062 * CAM1<n> = 1 & CAM0<n> = 0 => match if key<n> = 1
> 1063 * CAM1<n> = 0 & CAM0<n> = 0 => always match i.e dontcare.
> 1064 */
> --> 1065 if (kw_type == NPC_MCAM_KEY_X2) {
> ^^^^^^^
kw_type is set by npc_mcam_idx_2_key_type() call above.
> Uninitialized
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-10 9:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10 5:52 [bug report] octeontx2-af: npc: cn20k: Use common APIs Dan Carpenter
2026-04-10 9:52 ` Ratheesh Kannoth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox