[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220613013116.900591-1-chi.minghao@zte.com.cn>
Date: Mon, 13 Jun 2022 01:31:16 +0000
From: cgel.zte@...il.com
To: gregkh@...uxfoundation.org
Cc: olebowle@....com, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, Minghao Chi <chi.minghao@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: [PATCH V2] usb: core: Remove redundant NULL checks before kfree
From: Minghao Chi <chi.minghao@....com.cn>
Checking a pointer for NULL before calling kfree() on it is redundant,
kfree() deals with NULL pointers just fine.
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Minghao Chi <chi.minghao@....com.cn>
---
v1->v2:
remove "quirk_list = NULL"
drivers/usb/core/quirks.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index f99a65a64588..9ec12c42db30 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -56,10 +56,7 @@ static int quirks_param_set(const char *value, const
struct kernel_param *kp)
if (val[i] == ',')
quirk_count++;
- if (quirk_list) {
- kfree(quirk_list);
- quirk_list = NULL;
- }
+ kfree(quirk_list);
quirk_list = kcalloc(quirk_count, sizeof(struct quirk_entry),
GFP_KERNEL);
--
2.25.1
Powered by blists - more mailing lists