Commit 0ccccb04 authored by Zheng Yongjun's avatar Zheng Yongjun Committed by Jason Gunthorpe

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.comSigned-off-by: default avatarZheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent fe91b236
...@@ -202,7 +202,6 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group, ...@@ -202,7 +202,6 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
unsigned int i; unsigned int i;
unsigned int ports_num; unsigned int ports_num;
struct cma_dev_port_group *ports; struct cma_dev_port_group *ports;
int err;
ibdev = cma_get_ib_dev(cma_dev); ibdev = cma_get_ib_dev(cma_dev);
...@@ -213,10 +212,8 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group, ...@@ -213,10 +212,8 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
ports = kcalloc(ports_num, sizeof(*cma_dev_group->ports), ports = kcalloc(ports_num, sizeof(*cma_dev_group->ports),
GFP_KERNEL); GFP_KERNEL);
if (!ports) { if (!ports)
err = -ENOMEM; return -ENOMEM;
goto free;
}
for (i = 0; i < ports_num; i++) { for (i = 0; i < ports_num; i++) {
char port_str[10]; char port_str[10];
...@@ -232,12 +229,7 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group, ...@@ -232,12 +229,7 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
} }
cma_dev_group->ports = ports; cma_dev_group->ports = ports;
return 0; return 0;
free:
kfree(ports);
cma_dev_group->ports = NULL;
return err;
} }
static void release_cma_dev(struct config_item *item) static void release_cma_dev(struct config_item *item)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment