octeontx2-af: Fix klockwork issues in AF driver
PATCH 1/1 octeontx2-af: Fix klockwork issues in AF driver
This patch fixes multiple minor klockwork issues in octeontx2 AF driver. Most of the changes are related to variable initializations and null checks. These are not the real issues.
--- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 9 ++++++++- .../net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c | 6 ++++-- drivers/net/ethernet/marvell/octeontx2/af/ptp.c | 11 ++++++++++- drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c | 2 +- .../net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 8 +++++++- drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 2 +- drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 1 + 7 files changed, 32 insertions(+), 7 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +8 -1
@@ -465,6 +465,13 @@ u64 cgx_lmac_addr_get(u8 cgx_id, u8 lmac_id)u64 cfg;int id; +if (!cgx_dev) +return 0 ; + + lmac =lmac_pdata (lmac_id, cgx_dev); +if (!lmac) +return 0 ; + mac_ops = cgx_dev->mac_ops; id =get_sequence_id_of_lmac (cgx_dev, lmac_id);
@@ -1648,7 +1655,7 @@ unsigned long cgx_get_lmac_bmap(void *cgxd)static int cgx_lmac_init (struct cgx *cgx) {struct lmac *lmac; -u64 lmac_list; +u64 lmac_list =0 ;int i, err;/* lmac_list specifies which lmacs are enabled
drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c +4 -2
@@ -681,7 +681,7 @@ int rvu_mbox_handler_mcs_alloc_resources(struct rvu *rvu,u16 pcifunc = req->hdr.pcifunc;struct mcs_rsrc_map *map;struct mcs *mcs; -int rsrc_id, i; +int rsrc_id = -EINVAL , i;if (req->mcs_id >= rvu->mcs_blk_cnt)return MCS_AF_ERR_INVALID_MCSID ;
@@ -742,6 +742,8 @@ int rvu_mbox_handler_mcs_alloc_resources(struct rvu *rvu, rsp->rsrc_cnt++; }break ; +default : + goto exit; } rsp->rsrc_type = req->rsrc_type;
@@ -854,7 +856,7 @@ int rvu_mbox_handler_mcs_ctrl_pkt_rule_write(struct rvu *rvu,static void rvu_mcs_set_lmac_bmap (struct rvu *rvu) {struct mcs *mcs =mcs_get_pdata (0 ); -unsigned long lmac_bmap; +unsigned long lmac_bmap =0 ;int cgx, lmac, port;for (port =0 ; port < mcs->hw->lmac_cnt; port++) {
drivers/net/ethernet/marvell/octeontx2/af/ptp.c +10 -1
@@ -517,6 +517,7 @@ static int ptp_pps_on(struct ptp *ptp, int on, u64 period)static int ptp_probe (struct pci_dev *pdev,const struct pci_device_id *ent) { +void __iomem *const *base;struct ptp *ptp;int err;
@@ -536,7 +537,15 @@ static int ptp_probe(struct pci_dev *pdev,if (err) goto error_free; - ptp->reg_base =pcim_iomap_table (pdev)[PCI_PTP_BAR_NO ]; + base =pcim_iomap_table (pdev); +if (!base) + goto error_free; + + ptp->reg_base = base[PCI_PTP_BAR_NO ]; +if (!ptp->reg_base) { + err = -ENODEV ; + goto error_free; + }pci_set_drvdata (pdev, ptp);if (!first_ptp_block)
drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c +1 -1
@@ -43,7 +43,7 @@ static irqreturn_t cpt_af_flt_intr_handler(int vec, void *ptr)struct rvu *rvu = block->rvu;int blkaddr = block->addr;u64 reg, val; -int i, eng; +int i, eng =0 ;u8 grp; reg =rvu_read64 (rvu, blkaddr,CPT_AF_FLTX_INT (vec));
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +7 -1
@@ -519,12 +519,16 @@ RVU_DEBUG_SEQ_FOPS(mcs_rx_secy_stats, mcs_rx_secy_stats_display, NULL);static void rvu_dbg_mcs_init (struct rvu *rvu) {struct mcs *mcs; -char dname[10 ]; +char *dname =NULL ;int i;if (!rvu->mcs_blk_cnt)return ; + dname =kmalloc_array (rvu->mcs_blk_cnt,sizeof (char ),GFP_KERNEL ); +if (!dname) +return ; + rvu->rvu_dbg.mcs_root =debugfs_create_dir ("mcs" , rvu->rvu_dbg.root);for (i =0 ; i < rvu->mcs_blk_cnt; i++) {
@@ -568,6 +572,8 @@ static void rvu_dbg_mcs_init(struct rvu *rvu)debugfs_create_file ("port" ,0600 , rvu->rvu_dbg.mcs_tx, mcs, &rvu_dbg_mcs_tx_port_stats_fops); } + +kfree (dname); }#define LMT_MAPTBL_ENTRY_SIZE 16
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +1 -1
@@ -5375,7 +5375,7 @@ static void nix_inline_ipsec_cfg(struct rvu *rvu, struct nix_inline_ipsec_cfg *r int blkaddr) {u8 cpt_idx, cpt_blkaddr; -u64 val; +u64 val =0 ; cpt_idx = (blkaddr ==BLKADDR_NIX0 ) ?0 :1 ;if (req->enable) {
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +1 -0
@@ -1765,6 +1765,7 @@ static void npc_load_kpu_profile(struct rvu *rvu) rvu->kpu_prfl_addr =NULL ; }else {kfree (rvu->kpu_fwdata); + rvu->kpu_fwdata =NULL ; } rvu->kpu_fwdata =NULL ; rvu->kpu_fwdata_sz =0 ;
Signature · 1 line
2.25.1
Quoted 1 line
This patch fixes multiple minor klockwork issues in octeontx2 AF driver.
…
I guess that there is a need to split different change possibilities into separate update steps.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10-rc4#n81
Regards,
Markus
A message that is not in the archive (sent off-list or not yet received): SJ0PR18MB521611653D45DEDFC42704D9DBCB2@SJ0PR18MB5216.namprd18.prod.outlook.com
Quoted 2 lines
I guess that there is a need to split different change possibilities into separate update steps.
…
Quoted 3 lines
This is the first time I have submitted for klockwork fixes.
Since these are similar klockwork fixes based on variable declaration and NULL checks.
Did this source code analysis tool present items according to different development concerns (from selected categories)?
Quoted 1 line
I thought of combining the same.
Would you like to take the known advice “Solve only one problem per patch” better into account?
Please take another look at further approaches for the presentation of similar “change combinations”.
Quoted 1 line
Do you suggest 2 separate patch one for variable declaration and one for NULL checks?
Probably, yes.
Quoted 1 line
Or do I need to submit patch per file?
Maybe.
You can dare to offer software updates for each concern category
as patch series.
You can adapt then also better for constraints according to the selection of tags (like “Fixes” and “Cc”), can't you?
Regards,
Markus