summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Zhijian <lizhijian@fujitsu.com>2022-12-03 11:37:14 +0800
committerLeon Romanovsky <leon@kernel.org>2022-12-04 15:34:52 +0200
commit6978837ce42f8bea85041fc08c854f4e28852b3e (patch)
tree8bc72e90d5775476de55321e8361a245e1855401
parented461b30b22c8fa85c25189c14cb89f29595cd14 (diff)
RDMA/mlx5: no need to kfree NULL pointer
Goto label 'free' where it will kfree the 'in' is not needed though it's safe to kfree NULL. Return err code directly to simplify the code. 1973 free: 1974 kfree(in); 1975 return err; Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> Link: https://lore.kernel.org/r/20221203033714.25870-1-lizhijian@fujitsu.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
-rw-r--r--drivers/infiniband/hw/mlx5/mr.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 410cc5fd2523..053fe946e45a 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1929,10 +1929,8 @@ int mlx5_ib_alloc_mw(struct ib_mw *ibmw, struct ib_udata *udata)
ndescs = req.num_klms ? roundup(req.num_klms, 4) : roundup(1, 4);
in = kzalloc(inlen, GFP_KERNEL);
- if (!in) {
- err = -ENOMEM;
- goto free;
- }
+ if (!in)
+ return -ENOMEM;
mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry);