* [PATCH -next] infiniband: core: Delete useless kfree code
@ 2020-12-14 13:46 Zheng Yongjun
2020-12-15 7:53 ` Leon Romanovsky
0 siblings, 1 reply; 2+ messages in thread
From: Zheng Yongjun @ 2020-12-14 13:46 UTC (permalink / raw)
To: linux-rdma, linux-kernel; +Cc: Zheng Yongjun
The parameter of kfree function is NULL, so kfree code is useless, delete it.
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
drivers/infiniband/core/cma_configfs.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c
index 7ec4af2ed87a..c6e7cd9bc25a 100644
--- a/drivers/infiniband/core/cma_configfs.c
+++ b/drivers/infiniband/core/cma_configfs.c
@@ -235,7 +235,6 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
return 0;
free:
- kfree(ports);
cma_dev_group->ports = NULL;
return err;
}
--
2.22.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] infiniband: core: Delete useless kfree code
2020-12-14 13:46 [PATCH -next] infiniband: core: Delete useless kfree code Zheng Yongjun
@ 2020-12-15 7:53 ` Leon Romanovsky
0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2020-12-15 7:53 UTC (permalink / raw)
To: Zheng Yongjun; +Cc: linux-rdma, linux-kernel
On Mon, Dec 14, 2020 at 09:46:55PM +0800, Zheng Yongjun wrote:
> The parameter of kfree function is NULL, so kfree code is useless, delete it.
>
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
> drivers/infiniband/core/cma_configfs.c | 1 -
> 1 file changed, 1 deletion(-)
The best thing will be to delete whole "free:" section and return
an error immediately.
Thanks
>
> diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c
> index 7ec4af2ed87a..c6e7cd9bc25a 100644
> --- a/drivers/infiniband/core/cma_configfs.c
> +++ b/drivers/infiniband/core/cma_configfs.c
> @@ -235,7 +235,6 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
>
> return 0;
> free:
> - kfree(ports);
> cma_dev_group->ports = NULL;
> return err;
> }
> --
> 2.22.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-15 7:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 13:46 [PATCH -next] infiniband: core: Delete useless kfree code Zheng Yongjun
2020-12-15 7:53 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).