usnic: correctly handle kzalloc return value
authorInsu Yun <wuninsu@gmail.com>
Mon, 19 Oct 2015 16:57:10 +0000 (16:57 +0000)
committerDoug Ledford <dledford@redhat.com>
Wed, 21 Oct 2015 20:41:19 +0000 (16:41 -0400)
Since kzalloc returns memory address, not error code,
it should be checked whether it is null or not.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Reviewed-by: Dave Goodell <dgoodell@cisco.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c

index 85dc3f989ff72aa565c85efb4d07fdc7772d3c93..fcea3a24d3eb310ef0ee3c573a3ef9e161c8e809 100644 (file)
@@ -236,8 +236,8 @@ create_roce_custom_flow(struct usnic_ib_qp_grp *qp_grp,
 
        /* Create Flow Handle */
        qp_flow = kzalloc(sizeof(*qp_flow), GFP_ATOMIC);
-       if (IS_ERR_OR_NULL(qp_flow)) {
-               err = qp_flow ? PTR_ERR(qp_flow) : -ENOMEM;
+       if (!qp_flow) {
+               err = -ENOMEM;
                goto out_dealloc_flow;
        }
        qp_flow->flow = flow;
@@ -311,8 +311,8 @@ create_udp_flow(struct usnic_ib_qp_grp *qp_grp,
 
        /* Create qp_flow */
        qp_flow = kzalloc(sizeof(*qp_flow), GFP_ATOMIC);
-       if (IS_ERR_OR_NULL(qp_flow)) {
-               err = qp_flow ? PTR_ERR(qp_flow) : -ENOMEM;
+       if (!qp_flow) {
+               err = -ENOMEM;
                goto out_dealloc_flow;
        }
        qp_flow->flow = flow;
This page took 0.026663 seconds and 5 git commands to generate.