summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-10-03 12:53:41 +0200
committerDavid S. Miller <davem@davemloft.net>2017-10-03 19:26:58 +0200
commitb5c7d4e54c9ab830e5c03f92377fe15cbae64d0d (patch)
tree5715556cda939e6cde16c3888a8d6177920a411f
parentmlxsw: spectrum: Fix check for IS_ERR() instead of NULL (diff)
downloadlinux-b5c7d4e54c9ab830e5c03f92377fe15cbae64d0d.tar.xz
linux-b5c7d4e54c9ab830e5c03f92377fe15cbae64d0d.zip
mlxsw: spectrum: Add missing error code on allocation failure
We accidentally return success if the kmalloc_array() call fails. Fixes: 0e14c7777acb ("mlxsw: spectrum: Add the multicast routing hardware logic") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Yotam Gigi <yotamg@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c
index 3a61896ae4d8..39c21c70ac32 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c
@@ -771,8 +771,10 @@ mlxsw_sp_mr_tcam_region_init(struct mlxsw_sp *mlxsw_sp,
parman_prios = kmalloc_array(MLXSW_SP_MR_ROUTE_PRIO_MAX + 1,
sizeof(*parman_prios), GFP_KERNEL);
- if (!parman_prios)
+ if (!parman_prios) {
+ err = -ENOMEM;
goto err_parman_prios_alloc;
+ }
mr_tcam_region->parman_prios = parman_prios;
for (i = 0; i < MLXSW_SP_MR_ROUTE_PRIO_MAX + 1; i++)