mlxsw: spectrum_router: Fix an IS_ERR() vs NULL check
authorDan Carpenter <dan.carpenter@linaro.org>
Mon, 3 Jul 2023 15:24:52 +0000 (18:24 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Jul 2023 18:38:37 +0000 (19:38 +0100)
The mlxsw_sp_crif_alloc() function returns NULL on error.  It doesn't
return error pointers.  Fix the check.

Fixes: 78126cfd5dc9 ("mlxsw: spectrum_router: Maintain CRIF for fallback loopback RIF")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index 445ba7f..b32adf2 100644 (file)
@@ -10794,8 +10794,8 @@ static int mlxsw_sp_lb_rif_init(struct mlxsw_sp *mlxsw_sp,
        int err;
 
        router->lb_crif = mlxsw_sp_crif_alloc(NULL);
-       if (IS_ERR(router->lb_crif))
-               return PTR_ERR(router->lb_crif);
+       if (!router->lb_crif)
+               return -ENOMEM;
 
        /* Create a generic loopback RIF associated with the main table
         * (default VRF). Any table can be used, but the main table exists