From: Thorsten Blum Date: Sun, 1 Sep 2024 16:19:13 +0000 (+0200) Subject: nfs: Remove unnecessary NULL check before kfree() X-Git-Tag: v6.12-rc1~56^2~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e343678ee990912a132e94236fe028efe78696b0;p=thirdparty%2Fkernel%2Flinux.git nfs: Remove unnecessary NULL check before kfree() Since kfree() already checks if its argument is NULL, an additional check before calling kfree() is unnecessary and can be removed. Remove it and thus also the following Coccinelle/coccicheck warning reported by ifnullfree.cocci: WARNING: NULL check before some freeing functions is not needed Reviewed-by: Benjamin Coddington Signed-off-by: Thorsten Blum Reviewed-by: Jeff Layton Signed-off-by: Anna Schumaker --- diff --git a/fs/nfs/read.c b/fs/nfs/read.c index a6103333b6665..81bd1b9aba176 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -48,8 +48,7 @@ static struct nfs_pgio_header *nfs_readhdr_alloc(void) static void nfs_readhdr_free(struct nfs_pgio_header *rhdr) { - if (rhdr->res.scratch != NULL) - kfree(rhdr->res.scratch); + kfree(rhdr->res.scratch); kmem_cache_free(nfs_rdata_cachep, rhdr); }