[SPARC64]: Fix build failure when CONFIG_BUG is disabled.
authorDavid S. Miller <davem@bnsf.davemloft.net>
Mon, 29 Oct 2007 07:36:09 +0000 (00:36 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 31 Oct 2007 22:30:52 +0000 (15:30 -0700)
When CONFIG_BUG is turned off, the standard trick of:

switch (x) {
case X:
...
case Y:
...
default:
BUG();
};

to mark impossible cases does not work because BUG() evalutes
to nothing and thus GCC just sees a fallthrough code path.

Add an explicit KERN_ERR log message and a do_exit() to trap
this case.

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/mm/tsb.c

index 7ff0a02f58132e524a092f50b164605554e725ce..a3e6e4b635b3cc174aa91a33cb0a352b5261578a 100644 (file)
@@ -182,7 +182,9 @@ static void setup_tsb_params(struct mm_struct *mm, unsigned long tsb_idx, unsign
                break;
 
        default:
-               BUG();
+               printk(KERN_ERR "TSB[%s:%d]: Impossible TSB size %lu, killing process.\n",
+                      current->comm, current->pid, tsb_bytes);
+               do_exit(SIGSEGV);
        };
        tte |= pte_sz_bits(page_sz);