mlx4: corretly check failed allocation
authorInsu Yun <wuninsu@gmail.com>
Thu, 15 Oct 2015 16:24:09 +0000 (12:24 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Oct 2015 06:31:38 +0000 (23:31 -0700)
When allocation fails, mlx4_alloc_cmd_mailbox returns -ENOMEM.
Since there is no case that mlx4_alloc_cmd_mailbox returns NULL,
it needs to be checked by IS_ERR, not IS_ERR_OR_NULL

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/mr.c

index 78f51e103880d4dcae7745ec5cb5b2425e370e73..93195191f45bf00b09ff34a9db04ec9e0797f586 100644 (file)
@@ -318,7 +318,7 @@ int mlx4_mr_hw_get_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr,
                                key, NULL);
        } else {
                mailbox = mlx4_alloc_cmd_mailbox(dev);
-               if (IS_ERR_OR_NULL(mailbox))
+               if (IS_ERR(mailbox))
                        return PTR_ERR(mailbox);
 
                err = mlx4_cmd_box(dev, 0, mailbox->dma, key,