mlxsw: spectrum_dpipe: Add missing error path
authorIdo Schimmel <idosch@mellanox.com>
Fri, 7 Feb 2020 17:26:28 +0000 (19:26 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 7 Feb 2020 17:47:01 +0000 (18:47 +0100)
In case devlink_dpipe_entry_ctx_prepare() failed, release RTNL that was
previously taken and free the memory allocated by
mlxsw_sp_erif_entry_prepare().

Fixes: 2ba5999f009d ("mlxsw: spectrum: Add Support for erif table entries access")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c

index 49933818c6f5996489742ed06324c952b150dda0..2dc0978428e6493d3edc1b70621503436030eb28 100644 (file)
@@ -215,7 +215,7 @@ mlxsw_sp_dpipe_table_erif_entries_dump(void *priv, bool counters_enabled,
 start_again:
        err = devlink_dpipe_entry_ctx_prepare(dump_ctx);
        if (err)
-               return err;
+               goto err_ctx_prepare;
        j = 0;
        for (; i < rif_count; i++) {
                struct mlxsw_sp_rif *rif = mlxsw_sp_rif_by_index(mlxsw_sp, i);
@@ -247,6 +247,7 @@ start_again:
        return 0;
 err_entry_append:
 err_entry_get:
+err_ctx_prepare:
        rtnl_unlock();
        devlink_dpipe_entry_clear(&entry);
        return err;