mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daeseok Youn <daeseok.youn@gmail.com>
To: gregkh@linuxfoundation.org
Cc: sachin.kamat@linaro.org, shaun@xresource.ca,
	dulshani.gunawardhana89@gmail.com, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] staging: cxt1e1: remove redundant memset() call
Date: Fri, 14 Mar 2014 18:08:43 +0900	[thread overview]
Message-ID: <17439351.R8V0LkWGHs@daeseok-laptop.cloud.net> (raw)


The banner array doens't need to set to 0.
sprintf() adds a terminating '\0'.

And the sn array can be declared and initialized to zero.
So remove redundant memset() with zero.

Remove unnecessary cast for memcpy().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
---
 drivers/staging/cxt1e1/hwprobe.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/cxt1e1/hwprobe.c b/drivers/staging/cxt1e1/hwprobe.c
index d87a011..d41fb79 100644
--- a/drivers/staging/cxt1e1/hwprobe.c
+++ b/drivers/staging/cxt1e1/hwprobe.c
@@ -51,22 +51,16 @@ show_two(hdw_info_t *hi, int brdno)
 	struct pci_dev *pdev;
 	char       *bid;
 	char       banner[80];
-	char	sn[6];
-
-	/* clear print buffer */
-	memset(banner, 0, 80);
+	char	sn[6] = {0,};
 
 	ci = (ci_t *)(netdev_priv(hi->ndev));
 	bid = sbeid_get_bdname(ci);
 	switch (hi->promfmt) {
 	case PROM_FORMAT_TYPE1:
-		memcpy(sn, (FLD_TYPE1 *)(hi->mfg_info.pft1.Serial), 6);
+		memcpy(sn, hi->mfg_info.pft1.Serial, 6);
 		break;
 	case PROM_FORMAT_TYPE2:
-		memcpy(sn, (FLD_TYPE2 *)(hi->mfg_info.pft2.Serial), 6);
-		break;
-	default:
-		memset(sn, 0, 6);
+		memcpy(sn, hi->mfg_info.pft2.Serial, 6);
 		break;
 	}
 
-- 
1.7.4.4



                 reply	other threads:[~2014-03-14  9:08 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=17439351.R8V0LkWGHs@daeseok-laptop.cloud.net \
    --to=daeseok.youn@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dulshani.gunawardhana89@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sachin.kamat@linaro.org \
    --cc=shaun@xresource.ca \
    /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

all inboxes | Powered by JetHome®