* [PATCH] vmalloc: remove redundant NULL check
@ 2021-01-21 8:12 Yang Li
2021-01-21 8:23 ` Baoquan He
0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2021-01-21 8:12 UTC (permalink / raw)
To: dyoung
Cc: bhe, vgoyal, adobriyan, kexec, linux-kernel, linux-fsdevel, Yang Li
Fix below warnings reported by coccicheck:
./fs/proc/vmcore.c:1503:2-7: WARNING: NULL check before some freeing
functions is not needed.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <abaci-bugfix@linux.alibaba.com>
---
fs/proc/vmcore.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
index c3a345c..9a15334 100644
--- a/fs/proc/vmcore.c
+++ b/fs/proc/vmcore.c
@@ -1503,11 +1503,8 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
return 0;
out_err:
- if (buf)
- vfree(buf);
-
- if (dump)
- vfree(dump);
+ vfree(buf);
+ vfree(dump);
return ret;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] vmalloc: remove redundant NULL check
2021-01-21 8:12 [PATCH] vmalloc: remove redundant NULL check Yang Li
@ 2021-01-21 8:23 ` Baoquan He
0 siblings, 0 replies; 2+ messages in thread
From: Baoquan He @ 2021-01-21 8:23 UTC (permalink / raw)
To: Yang Li
Cc: dyoung, vgoyal, adobriyan, kexec, linux-kernel, akpm, linux-fsdevel
On 01/21/21 at 04:12pm, Yang Li wrote:
> Fix below warnings reported by coccicheck:
> ./fs/proc/vmcore.c:1503:2-7: WARNING: NULL check before some freeing
> functions is not needed.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <abaci-bugfix@linux.alibaba.com>
> ---
> fs/proc/vmcore.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
> index c3a345c..9a15334 100644
> --- a/fs/proc/vmcore.c
> +++ b/fs/proc/vmcore.c
> @@ -1503,11 +1503,8 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
> return 0;
>
> out_err:
> - if (buf)
> - vfree(buf);
> -
> - if (dump)
> - vfree(dump);
> + vfree(buf);
> + vfree(dump);
Looks good, thx.
Acked-by: Baoquan He <bhe@redhat.com>
Thanks
Baoquan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-21 8:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 8:12 [PATCH] vmalloc: remove redundant NULL check Yang Li
2021-01-21 8:23 ` Baoquan He
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).