Skip to content

Commit

Permalink
common/cnxk: add missing checks of return values
Browse files Browse the repository at this point in the history
[ upstream commit 14f7e5d ]

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

Coverity issue: 373628, 374858, 370213, 370215
Fixes: af75aac ("common/cnxk: support telemetry for NIX")
Fixes: d61138d ("drivers: remove direct access to interrupt handle")
Fixes: fcdef46 ("common/cnxk: support NIX TM debug and misc utils")
Fixes: df405df ("common/cnxk: add NIX TM helper to alloc/free resource")

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
  • Loading branch information
Gowrishankar Muthukrishnan authored and kevintraynor committed Feb 28, 2022
1 parent dd1851c commit 7eeb8d3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions drivers/common/cnxk/cnxk_telemetry_nix.c
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion drivers/common/cnxk/roc_irq.c
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion drivers/common/cnxk/roc_nix_debug.c
Expand Up @@ -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[");
Expand Down
6 changes: 4 additions & 2 deletions drivers/common/cnxk/roc_nix_tm.c
Expand Up @@ -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 */
Expand Down

0 comments on commit 7eeb8d3

Please sign in to comment.