mlxsw: spectrum_router: Return -ENOENT in case of error
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Thu, 14 Jul 2016 06:18:45 +0000 (08:18 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Jul 2016 05:14:54 +0000 (22:14 -0700)
'vr' should be a valid pointer here, so returning 'PTR_ERR(vr)' is wrong.
Return an explicit error code (-ENOENT) instead.

Fixes: 61c503f976 ("mlxsw: spectrum_router: Implement fib4 add/del switchdev obj ops")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index e084ea5448ac52e903781e57c1a910c860b8d9e5..81418d629231667e7fe879fd767e9446eae4eac3 100644 (file)
@@ -1803,7 +1803,7 @@ int mlxsw_sp_router_fib4_del(struct mlxsw_sp_port *mlxsw_sp_port,
                                              sizeof(fib4->dst), fib4->dst_len);
        if (!fib_entry) {
                dev_warn(mlxsw_sp->bus_info->dev, "Failed to find FIB4 entry being removed.\n");
-               return PTR_ERR(vr);
+               return -ENOENT;
        }
        mlxsw_sp_fib_entry_del(mlxsw_sp_port->mlxsw_sp, fib_entry);
        mlxsw_sp_fib_entry_remove(vr->fib, fib_entry);