Skip to content

Commit b5c7d4e

Browse files
Dan Carpenterdavem330
authored andcommitted
mlxsw: spectrum: Add missing error code on allocation failure
We accidentally return success if the kmalloc_array() call fails. Fixes: 0e14c77 ("mlxsw: spectrum: Add the multicast routing hardware logic") Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Yotam Gigi <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b508e0b commit b5c7d4e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,10 @@ mlxsw_sp_mr_tcam_region_init(struct mlxsw_sp *mlxsw_sp,
771771

772772
parman_prios = kmalloc_array(MLXSW_SP_MR_ROUTE_PRIO_MAX + 1,
773773
sizeof(*parman_prios), GFP_KERNEL);
774-
if (!parman_prios)
774+
if (!parman_prios) {
775+
err = -ENOMEM;
775776
goto err_parman_prios_alloc;
777+
}
776778
mr_tcam_region->parman_prios = parman_prios;
777779

778780
for (i = 0; i < MLXSW_SP_MR_ROUTE_PRIO_MAX + 1; i++)

0 commit comments

Comments
 (0)