Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1278710

[PATCH 3/3] usb: musb: remove redundant stack buffer

From Rasmus Villemoes <linux@rasmusvillemoes.dk>
Newsgroups linux.kernel
Subject [PATCH 3/3] usb: musb: remove redundant stack buffer
Date 2015-11-27 11:40 +0100
Message-ID <qzoBA-1DT-29@gated-at.bofh.it> (permalink)
References <qzoBz-1DT-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


aRevision is only used once, so we might as well do the formatting as
part of the pr_debug. This eliminates the stack buffer, and avoids
doing the formatting at all when pr_debug is compiled out.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/usb/musb/musb_core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 86dce9635b14..3e8d1bcfc1b5 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1458,7 +1458,7 @@ static int musb_core_init(u16 musb_type, struct musb *musb)
 {
 	u8 reg;
 	char *type;
-	char aInfo[90], aRevision[32];
+	char aInfo[90];
 	void __iomem	*mbase = musb->mregs;
 	int		status = 0;
 	int		i;
@@ -1506,11 +1506,11 @@ static int musb_core_init(u16 musb_type, struct musb *musb)
 
 	/* log release info */
 	musb->hwvers = musb_read_hwvers(mbase);
-	snprintf(aRevision, 32, "%d.%d%s", MUSB_HWVERS_MAJOR(musb->hwvers),
-		MUSB_HWVERS_MINOR(musb->hwvers),
-		(musb->hwvers & MUSB_HWVERS_RC) ? "RC" : "");
-	pr_debug("%s: %sHDRC RTL version %s\n",
-		 musb_driver_name, type, aRevision);
+	pr_debug("%s: %sHDRC RTL version %d.%d%s\n",
+		 musb_driver_name, type,
+		 MUSB_HWVERS_MAJOR(musb->hwvers),
+		 MUSB_HWVERS_MINOR(musb->hwvers),
+		 (musb->hwvers & MUSB_HWVERS_RC) ? "RC" : "");
 
 	/* configure ep0 */
 	musb_configure_ep0(musb);
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] usb: musb: convert printk to pr_* Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-11-27 11:40 +0100
  [PATCH 3/3] usb: musb: remove redundant stack buffer Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-11-27 11:40 +0100
  [PATCH 2/3] usb: musb: remove always-empty string from debug output Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-11-27 11:40 +0100
  Re: [PATCH 1/3] usb: musb: convert printk to pr_* Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-11-27 13:30 +0100
    Re: [PATCH 1/3] usb: musb: convert printk to pr_* Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-11-28 01:10 +0100
      Re: [PATCH 1/3] usb: musb: convert printk to pr_* Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-11-28 11:30 +0100

csiph-web