Skip to content

Commit 0ccccb0

Browse files
Zheng Yongjunjgunthorpe
authored andcommitted
RDMA/cma: Delete useless kfree code
The parameter of kfree function is NULL, so kfree code is useless, delete it. Therefore, goto expression is no longer needed, so simplify it. cma_dev_group is always pre-zero'd before reaching make_cma_ports, so the NULL set to cma_dev_group->ports is unneeded too. Link: https://lore.kernel.org/r/20201216080219.18184-1-zhengyongjun3@huawei.com Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent fe91b23 commit 0ccccb0

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

drivers/infiniband/core/cma_configfs.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
202202
unsigned int i;
203203
unsigned int ports_num;
204204
struct cma_dev_port_group *ports;
205-
int err;
206205

207206
ibdev = cma_get_ib_dev(cma_dev);
208207

@@ -213,10 +212,8 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
213212
ports = kcalloc(ports_num, sizeof(*cma_dev_group->ports),
214213
GFP_KERNEL);
215214

216-
if (!ports) {
217-
err = -ENOMEM;
218-
goto free;
219-
}
215+
if (!ports)
216+
return -ENOMEM;
220217

221218
for (i = 0; i < ports_num; i++) {
222219
char port_str[10];
@@ -232,12 +229,7 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
232229

233230
}
234231
cma_dev_group->ports = ports;
235-
236232
return 0;
237-
free:
238-
kfree(ports);
239-
cma_dev_group->ports = NULL;
240-
return err;
241233
}
242234

243235
static void release_cma_dev(struct config_item *item)

0 commit comments

Comments
 (0)