[PATCH for-next 03/11] RDMA/hns: Check return value of kmalloc with macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Yixian Liu <liuyixian@xxxxxxxxxx>

As the return value of kmalloc may be null or error code, use kernel macro
to do return value check.

Signed-off-by: Yixian Liu <liuyixian@xxxxxxxxxx>
Signed-off-by: Weihang Li <liweihang@xxxxxxxxxx>
---
 drivers/infiniband/hw/hns/hns_roce_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_cmd.c b/drivers/infiniband/hw/hns/hns_roce_cmd.c
index 455d533..d52311a 100644
--- a/drivers/infiniband/hw/hns/hns_roce_cmd.c
+++ b/drivers/infiniband/hw/hns/hns_roce_cmd.c
@@ -268,7 +268,7 @@ struct hns_roce_cmd_mailbox
 	struct hns_roce_cmd_mailbox *mailbox;
 
 	mailbox = kmalloc(sizeof(*mailbox), GFP_KERNEL);
-	if (!mailbox)
+	if (IS_ERR_OR_NULL(mailbox))
 		return ERR_PTR(-ENOMEM);
 
 	mailbox->buf = dma_pool_alloc(hr_dev->cmd.pool, GFP_KERNEL,
-- 
2.8.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux