From: Dan Carpenter Date: Mon, 12 Jan 2015 08:56:58 +0000 (+0300) Subject: IB/mlx5: Fix error code in get_port_caps() X-Git-Tag: firefly_0821_release~176^2~2252^2^5 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f614fc15ae39ceb531586e3969f2b99fd23182a0;p=firefly-linux-kernel-4.4.55.git IB/mlx5: Fix error code in get_port_caps() 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 Signed-off-by: Roland Dreier --- diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 03bf81211a54..b1eda4a602a8 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -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;