summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx4
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2012-04-11 23:43:29 +0200
committerRoland Dreier <roland@purestorage.com>2012-04-25 01:11:21 +0200
commitbf6b47deb40f9fc8ddb4573373dc9614aab59d35 (patch)
tree866e0dedc84ce00105a009b701e8801b6fbe1622 /drivers/infiniband/hw/mlx4
parentLinux 3.4-rc2 (diff)
downloadlinux-bf6b47deb40f9fc8ddb4573373dc9614aab59d35.tar.xz
linux-bf6b47deb40f9fc8ddb4573373dc9614aab59d35.zip
IB/mlx4: Fix memory leaks in ib_link_query_port()
If the call to mlx4_MAD_IFC() fails in ib_link_query_port() we will currently do 'return err;' which will leak 'in_mad' and 'out_mad'. We should instead do 'goto out;' where we'll properly free the memory we previously allocated. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Acked-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx4')
-rw-r--r--drivers/infiniband/hw/mlx4/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 75d305629300..cc88c9c955c9 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -247,7 +247,7 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port,
err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port,
NULL, NULL, in_mad, out_mad);
if (err)
- return err;
+ goto out;
/* Checking LinkSpeedActive for FDR-10 */
if (out_mad->data[15] & 0x1)