Re: [PATCH -next] infiniband: core: Delete useless kfree code

From: Leon Romanovsky
Date: Tue Dec 15 2020 - 02:55:10 EST


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@xxxxxxxxxx>
> ---
> 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
>