linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] genirq: remove unnecessary memset() calls.
@ 2016-03-31 19:15 Weongyo Jeong
  2016-06-10 19:46 ` [tip:irq/core] genirq: Remove " tip-bot for Weongyo Jeong
  0 siblings, 1 reply; 2+ messages in thread
From: Weongyo Jeong @ 2016-03-31 19:15 UTC (permalink / raw)
  To: open list:IRQ SUBSYSTEM; +Cc: Weongyo Jeong, Thomas Gleixner

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:irq/core] genirq: Remove unnecessary memset() calls
  2016-03-31 19:15 [PATCH] genirq: remove unnecessary memset() calls Weongyo Jeong
@ 2016-06-10 19:46 ` tip-bot for Weongyo Jeong
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Weongyo Jeong @ 2016-06-10 19:46 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, weongyo.linux

Commit-ID:  ff5b706f5189fe8d2a6fd576b491b769ec1d29d3
Gitweb:     http://git.kernel.org/tip/ff5b706f5189fe8d2a6fd576b491b769ec1d29d3
Author:     Weongyo Jeong <weongyo.linux@gmail.com>
AuthorDate: Thu, 31 Mar 2016 12:15:03 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 10 Jun 2016 17:07:50 +0200

genirq: Remove unnecessary memset() calls

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>
Link: http://lkml.kernel.org/r/1459451703-5744-1-git-send-email-weongyo.linux@gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 kernel/irq/proc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 50a8f28..f30425d 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);
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-10 19:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-31 19:15 [PATCH] genirq: remove unnecessary memset() calls Weongyo Jeong
2016-06-10 19:46 ` [tip:irq/core] genirq: Remove " tip-bot for Weongyo Jeong

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