Subject: [bug report] octeontx2-af: npc: cn20k: Use common APIs

From: Dan Carpenter <[email-masked]>
Date: Fri, 10 Apr 2026 08:52:38 +0300

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