linux-btrace.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blktrace:remove redundant memset() following calloc()
@ 2021-09-07 20:26 songkai
  0 siblings, 0 replies; only message in thread
From: songkai @ 2021-09-07 20:26 UTC (permalink / raw)
  To: linux-btrace

memset() is unnecessary when using calloc() to allocate space,remove it.

Signed-off-by: songkai <songkai01@inspur.com>
---
 blktrace.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/blktrace.c b/blktrace.c
index 3444fbb..4fd1f83 100644
--- a/blktrace.c
+++ b/blktrace.c
@@ -1088,7 +1088,6 @@ static int setup_buts(void)
 			if (dpp->stats)
 				free(dpp->stats);
 			dpp->stats = calloc(dpp->ncpus, sizeof(*dpp->stats));
-			memset(dpp->stats, 0, dpp->ncpus * sizeof(*dpp->stats));
 		} else {
 			fprintf(stderr, "BLKTRACESETUP(2) %s failed: %d/%s\n",
 				dpp->path, errno, strerror(errno));
@@ -1658,10 +1657,8 @@ static int open_ios(struct tracer *tp)
 	struct list_head *p;
 
 	tp->ios = calloc(ndevs, sizeof(struct io_info));
-	memset(tp->ios, 0, ndevs * sizeof(struct io_info));
 
 	tp->pfds = calloc(ndevs, sizeof(struct pollfd));
-	memset(tp->pfds, 0, ndevs * sizeof(struct pollfd));
 
 	tp->nios = 0;
 	iop = tp->ios;
@@ -2417,13 +2414,11 @@ static struct devpath *nc_add_dpp(struct cl_conn *nc,
 	dpp->cl_connect_time = connect_time;
 	dpp->ncpus = nc->ncpus;
 	dpp->stats = calloc(dpp->ncpus, sizeof(*dpp->stats));
-	memset(dpp->stats, 0, dpp->ncpus * sizeof(*dpp->stats));
 
 	list_add_tail(&dpp->head, &nc->ch->devpaths);
 	nc->ch->ndevs++;
 
 	dpp->ios = calloc(nc->ncpus, sizeof(*iop));
-	memset(dpp->ios, 0, ndevs * sizeof(*iop));
 
 	for (cpu = 0, iop = dpp->ios; cpu < nc->ncpus; cpu++, iop++) {
 		iop->dpp = dpp;
-- 
2.27.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-07 20:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 20:26 [PATCH] blktrace:remove redundant memset() following calloc() songkai

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).