Skip to content

Commit

Permalink
lib/bug.c: convert printk to pr_foo()
Browse files Browse the repository at this point in the history
- Coalesce formats

- "WARNING:" prefix unchanged to keep bug format.

- printk(KERN_DEFAULT not converted.

- define pr_fmt without prefix to avoid any default prefix update
  (suggested by Joe Perches).

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Fabian Frederick authored and torvalds committed Jun 4, 2014
1 parent ce643a3 commit c56ba70
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions lib/bug.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
Jeremy Fitzhardinge <jeremy@goop.org> 2006
*/

#define pr_fmt(fmt) fmt

#include <linux/list.h>
#include <linux/module.h>
#include <linux/kernel.h>
Expand Down Expand Up @@ -153,15 +156,13 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)

if (warning) {
/* this is a WARN_ON rather than BUG/BUG_ON */
printk(KERN_WARNING "------------[ cut here ]------------\n");
pr_warn("------------[ cut here ]------------\n");

if (file)
printk(KERN_WARNING "WARNING: at %s:%u\n",
file, line);
pr_warn("WARNING: at %s:%u\n", file, line);
else
printk(KERN_WARNING "WARNING: at %p "
"[verbose debug info unavailable]\n",
(void *)bugaddr);
pr_warn("WARNING: at %p [verbose debug info unavailable]\n",
(void *)bugaddr);

print_modules();
show_regs(regs);
Expand All @@ -174,12 +175,10 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
printk(KERN_DEFAULT "------------[ cut here ]------------\n");

if (file)
printk(KERN_CRIT "kernel BUG at %s:%u!\n",
file, line);
pr_crit("kernel BUG at %s:%u!\n", file, line);
else
printk(KERN_CRIT "Kernel BUG at %p "
"[verbose debug info unavailable]\n",
(void *)bugaddr);
pr_crit("Kernel BUG at %p [verbose debug info unavailable]\n",
(void *)bugaddr);

return BUG_TRAP_TYPE_BUG;
}

0 comments on commit c56ba70

Please sign in to comment.