mlxsw: spectrum: Add missing error code on allocation failure
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 3 Oct 2017 10:53:41 +0000 (13:53 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 Oct 2017 17:26:58 +0000 (10:26 -0700)
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>
drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c

index 3a61896ae4d817c50a66f6413edbe8d1004c643b..39c21c70ac323a88ce7d692a64f45e03f6739fab 100644 (file)
@@ -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++)