]> err.no Git - linux-2.6/commitdiff
RDMA/cxgb3: Check return of kmalloc() in iwch_register_device()
authorWANG Cong <xiyou.wangcong@gmail.com>
Tue, 10 Jul 2007 03:12:26 +0000 (20:12 -0700)
committerRoland Dreier <rolandd@cisco.com>
Tue, 10 Jul 2007 03:12:26 +0000 (20:12 -0700)
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
[ Also remove cast from void * return of kmalloc() as suggested by
  Jesper Juhl <jesper.juhl@gmail.com>. ]
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/cxgb3/iwch_provider.c

index e7c2c3948037e6853586be07e01f2c1f3b5731bb..f0c777589374cccf1af919534805675246e05f2c 100644 (file)
@@ -1163,9 +1163,10 @@ int iwch_register_device(struct iwch_dev *dev)
        dev->ibdev.post_recv = iwch_post_receive;
 
 
-       dev->ibdev.iwcm =
-           (struct iw_cm_verbs *) kmalloc(sizeof(struct iw_cm_verbs),
-                                          GFP_KERNEL);
+       dev->ibdev.iwcm = kmalloc(sizeof(struct iw_cm_verbs), GFP_KERNEL);
+       if (!dev->ibdev.iwcm)
+               return -ENOMEM;
+
        dev->ibdev.iwcm->connect = iwch_connect;
        dev->ibdev.iwcm->accept = iwch_accept_cr;
        dev->ibdev.iwcm->reject = iwch_reject_cr;