common/cnxk: add missing checks of return values

This patch fixes coverity issue by adding checks on return values.

Coverity issue: 373628, 374858, 370213, 370215
Fixes: af75aac78978 ("common/cnxk: support telemetry for NIX")
Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")
Fixes: fcdef46b6698 ("common/cnxk: support NIX TM debug and misc utils")
Fixes: df405df95eeb ("common/cnxk: add NIX TM helper to alloc/free resource")
Cc: stable@dpdk.org

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
This commit is contained in:
Gowrishankar Muthukrishnan 2022-02-12 18:08:18 +05:30 committed by Jerin Jacob
parent 622ee0bf35
commit 14f7e5d4bf
4 changed files with 14 additions and 4 deletions

View File

@ -765,6 +765,9 @@ cnxk_nix_tel_handle_info_x(const char *cmd, const char *params,
plt_strlcpy(buf, params, PCI_PRI_STR_SIZE + 1);
name = strtok(buf, ",");
if (name == NULL)
goto exit;
param = strtok(NULL, "\0");
node = nix_tel_node_get_by_pcidev_name(name);

View File

@ -160,7 +160,10 @@ dev_irq_register(struct plt_intr_handle *intr_handle, plt_intr_callback_fn cb,
return rc;
}
plt_intr_efds_index_set(intr_handle, vec, fd);
rc = plt_intr_efds_index_set(intr_handle, vec, fd);
if (rc)
return rc;
nb_efd = (vec > (uint32_t)plt_intr_nb_efd_get(intr_handle)) ?
vec : (uint32_t)plt_intr_nb_efd_get(intr_handle);
plt_intr_nb_efd_set(intr_handle, nb_efd);

View File

@ -52,7 +52,9 @@ nix_bitmap_dump(struct plt_bitmap *bmp)
int i;
plt_bitmap_scan_init(bmp);
plt_bitmap_scan(bmp, &pos, &slab);
if (!plt_bitmap_scan(bmp, &pos, &slab))
return;
start_pos = pos;
nix_dump_no_nl(" \t\t[");

View File

@ -1016,8 +1016,10 @@ nix_tm_assign_hw_id(struct nix *nix, struct nix_tm_node *parent,
return -EFAULT;
}
if (!slab)
plt_bitmap_scan(bmp, &pos, &slab);
if (!slab) {
if (!plt_bitmap_scan(bmp, &pos, &slab))
return -ENOENT;
}
if (child->priority == parent->rr_prio && spare_schq != -1) {
/* Use spare schq first if present */