linux-btrace.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: songkai <songkai01@inspur.com>
To: linux-btrace@vger.kernel.org
Subject: [PATCH] blktrace:remove redundant memset() following calloc()
Date: Tue, 07 Sep 2021 20:26:46 +0000	[thread overview]
Message-ID: <20210907202646.110452-1-songkai01@inspur.com> (raw)

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

                 reply	other threads:[~2021-09-07 20:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210907202646.110452-1-songkai01@inspur.com \
    --to=songkai01@inspur.com \
    --cc=linux-btrace@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).