linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: Use WARN() in uasm for better diagnostics.

To: David Daney <ddaney@caviumnetworks.com>
Subject: Re: [PATCH] MIPS: Use WARN() in uasm for better diagnostics.
From: Sergei Shtylyov <sshtylyov@mvista.com>
Date: Tue, 28 Dec 2010 18:44:25 +0300
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
In-reply-to: <1293502709-11454-1-git-send-email-ddaney@caviumnetworks.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1293502709-11454-1-git-send-email-ddaney@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 2.0.0.21 (X11/20090320)
Hello.

David Daney wrote:

On the off chance that uasm ever warns about overflow, there is no way
to know what the offending instruction is.

Change the printks to WARNs, so we can get a nice stack trace.  It has
the added benefit of being much more noticeable than the short single
line warning message, so is less likely to be ignored.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/mm/uasm.c |   40 ++++++++++++++++------------------------
 1 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c
index 357916d..4008c79 100644
--- a/arch/mips/mm/uasm.c
+++ b/arch/mips/mm/uasm.c
@@ -156,91 +156,83 @@ static struct insn insn_table[] __uasminitdata = {
[...]
 static inline __uasminit u32 build_jimm(u32 arg)
 {
-       if (arg & ~((JIMM_MASK) << 2))
-               printk(KERN_WARNING "Micro-assembler field overflow\n");
+       WARN(arg & ~((JIMM_MASK) << 2),

   Could drop parens around JIMM_MASK while at it...

WBR, Sergei

<Prev in Thread] Current Thread [Next in Thread>