mlx4: corretly check failed allocation
Subsystems (3)
PATCH 1/1 mlx4: corretly check failed allocation
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 <[email protected]>
--- drivers/net/ethernet/mellanox/mlx4/mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/mr.c +1 -1
@@ -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,
Signature · 1 line
1.9.1
From: Insu Yun <[email protected]>
Date: Thu, 15 Oct 2015 12:24:09 -0400
Quoted 5 lines
When allocation fails,
mlx4_alloc_cmd_mailboxreturns-ENOMEM. Since there is no case thatmlx4_alloc_cmd_mailboxreturns NULL, it needs to be checked byIS_ERR, notIS_ERR_OR_NULLSigned-off-by Insu Yun <[email protected]>
Applied to net-next, thanks.