Re: [PATCH] io_uring/net: Remove unneeded if check in io_net_vec_assign()

From: Jens Axboe
Date: Sun Aug 11 2024 - 18:31:38 EST


On 8/11/24 4:26 PM, Thorsten Blum wrote:
> kfree() already checks if its argument is NULL. Remove the unneeded if
> check and fix the following Coccinelle/coccicheck warning reported by
> ifnullfree.cocci:
>
> WARNING: NULL check before some freeing functions is not needed

Yes it's not needed, but the NULL check is done after a function call.
For the hot path, it's FASTER to check if it's NULL or not.

I can put a comment on these, but honestly I wish the ifnullfree
thing would just go away as it's hardly useful for anything. It's
not like it's a bug to check for NULL first, or that it would find
something useful.

--
Jens Axboe