linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Weongyo Jeong <weongyo.linux@gmail.com>
To: linux-kernel@vger.kernel.org (open list:IRQ SUBSYSTEM)
Cc: Weongyo Jeong <weongyo.linux@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH] genirq: remove unnecessary memset() calls.
Date: Thu, 31 Mar 2016 12:15:03 -0700	[thread overview]
Message-ID: <1459451703-5744-1-git-send-email-weongyo.linux@gmail.com> (raw)

sprintf() and snprintf() implementation of kernel guarantees that
its result is terminated with null byte if size is larger than 0. So we
don't need to call memset() at all.

Signed-off-by: Weongyo Jeong <weongyo.linux@gmail.com>
---
 kernel/irq/proc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 4e1b947..90dfbca 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -311,7 +311,6 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
 					!name_unique(irq, action))
 		return;
 
-	memset(name, 0, MAX_NAMELEN);
 	snprintf(name, MAX_NAMELEN, "%s", action->name);
 
 	/* create /proc/irq/1234/handler/ */
@@ -340,7 +339,6 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
 	if (desc->dir)
 		goto out_unlock;
 
-	memset(name, 0, MAX_NAMELEN);
 	sprintf(name, "%d", irq);
 
 	/* create /proc/irq/1234 */
@@ -386,7 +384,6 @@ void unregister_irq_proc(unsigned int irq, struct irq_desc *desc)
 #endif
 	remove_proc_entry("spurious", desc->dir);
 
-	memset(name, 0, MAX_NAMELEN);
 	sprintf(name, "%u", irq);
 	remove_proc_entry(name, root_irq_dir);
 }
-- 
2.1.3

             reply	other threads:[~2016-03-31 19:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31 19:15 Weongyo Jeong [this message]
2016-06-10 19:46 ` [tip:irq/core] genirq: Remove unnecessary memset() calls tip-bot for Weongyo Jeong

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=1459451703-5744-1-git-send-email-weongyo.linux@gmail.com \
    --to=weongyo.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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 NNTP newsgroup(s).