IB/mlx5: Fix error code in get_port_caps()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 12 Jan 2015 08:56:58 +0000 (11:56 +0300)
committerRoland Dreier <roland@purestorage.com>
Tue, 17 Feb 2015 18:22:59 +0000 (10:22 -0800)
The current code returns success when kmalloc() fails.  It should
return an error code, -ENOMEM.

Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/mlx5/main.c

index 03bf812..b1eda4a 100644 (file)
@@ -997,7 +997,7 @@ static int get_port_caps(struct mlx5_ib_dev *dev)
        struct ib_device_attr *dprops = NULL;
        struct ib_port_attr *pprops = NULL;
        struct mlx5_general_caps *gen;
-       int err = 0;
+       int err = -ENOMEM;
        int port;
 
        gen = &dev->mdev->caps.gen;