Re: [PATCH -next] io_uring: Remove unneeded if-null-free check
From: Pavel Begunkov
Date: Tue Jun 15 2021 - 09:38:42 EST
On 6/2/21 7:54 AM, Zheng Yongjun wrote:
> Eliminate the following coccicheck warning:
>
> fs/io_uring.c:6056:4-9: WARNING: NULL check before some freeing functions is not needed.
> fs/io_uring.c:1744:2-7: WARNING: NULL check before some freeing functions is not needed.
> fs/io_uring.c:3340:2-7: WARNING: NULL check before some freeing functions is not needed.
> fs/io_uring.c:4612:2-7: WARNING: NULL check before some freeing functions is not needed.
> fs/io_uring.c:4375:2-7: WARNING: NULL check before some freeing functions is not needed.
> fs/io_uring.c:3441:2-7: WARNING: NULL check before some freeing functions is not needed.
Take a look at the comments right above changed lines.
>
> Signed-off-by: Zheng Yongjun <zhengyongjun3@xxxxxxxxxx>
> ---
> fs/io_uring.c | 18 ++++++------------
> 1 file changed, 6 insertions(+), 12 deletions(-)
[...]
> /* it's reportedly faster than delegating the null check to kfree() */
> - if (iovec)
> - kfree(iovec);
> + kfree(iovec);
[...]
--
Pavel Begunkov