MALLOC(x) maps to calloc(1, x), which already init var to zero.
In alloc_waiter func, the superfluous memset(wp) call is useless,
and it should be removed.

V1->V2:
- remove useless memset call after MALLOC (as suggested by Martin)

Signed-off-by: Zhiqiang Liu <[email protected]>
Signed-off-by: lixiaokeng <[email protected]>
---
 multipathd/waiter.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/multipathd/waiter.c b/multipathd/waiter.c
index e6457663..da4017b9 100644
--- a/multipathd/waiter.c
+++ b/multipathd/waiter.c
@@ -29,13 +29,7 @@ struct mutex_lock waiter_lock = { .mutex = 
PTHREAD_MUTEX_INITIALIZER };

 static struct event_thread *alloc_waiter (void)
 {
-
-       struct event_thread *wp;
-
-       wp = (struct event_thread *)MALLOC(sizeof(struct event_thread));
-       memset(wp, 0, sizeof(struct event_thread));
-
-       return wp;
+       return (struct event_thread *)MALLOC(sizeof(struct event_thread));
 }

 static void free_waiter (void *data)
-- 
2.24.0.windows.2



--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to