mlxsw: spectrum: Fix check for IS_ERR() instead of NULL
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 3 Oct 2017 10:53:03 +0000 (13:53 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 Oct 2017 17:26:58 +0000 (10:26 -0700)
mlxsw_afa_block_create() doesn't return error pointers, it returns NULL
on error.

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 3ffb28dd40576a977e10601ec7e9851cce0c8fd3..3a61896ae4d817c50a66f6413edbe8d1004c643b 100644 (file)
@@ -239,8 +239,8 @@ mlxsw_sp_mr_tcam_afa_block_create(struct mlxsw_sp *mlxsw_sp,
        int err;
 
        afa_block = mlxsw_afa_block_create(mlxsw_sp->afa);
-       if (IS_ERR(afa_block))
-               return afa_block;
+       if (!afa_block)
+               return ERR_PTR(-ENOMEM);
 
        err = mlxsw_afa_block_append_counter(afa_block, counter_index);
        if (err)