mm: ksm use pr_err instead of printk
PATCH 1/1 mm: ksm use pr_err instead of printk
WARNING: Prefer: pr_err(... to printk(KERN_ERR ...
--- mm/ksm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/ksm.c +2 -2
@@ -2310,7 +2310,7 @@ static int __init ksm_init(void) ksm_thread =kthread_run (ksm_scan_thread,NULL ,"ksmd" );if (IS_ERR (ksm_thread)) { -printk (KERN_ERR "ksm: creating kthread failed\n" ); +pr_err (KERN_ERR "ksm: creating kthread failed\n" ); err =PTR_ERR (ksm_thread); goto out_free; }
@@ -2318,7 +2318,7 @@ static int __init ksm_init(void)#ifdef CONFIG_SYSFS err =sysfs_create_group (mm_kobj, &ksm_attr_group);if (err) { -printk (KERN_ERR "ksm: register sysfs failed\n" ); +pr_err (KERN_ERR "ksm: register sysfs failed\n" );kthread_stop (ksm_thread); goto out_free; }
Signature · 7 lines
1.9.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 21 lines · On Wed, 1 Oct 2014 21:35:30 +0100 Paul McQuade <[email protected]> wrote:
WARNING: Prefer: pr_err(... to printk(KERN_ERR ...
Signed-off-by Paul McQuade <[email protected]>--- mm/ksm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)mm/ksm.c +1
-1@@ -2310,7 +2310,7 @@ static int __init ksm_init(void) ksm_thread =kthread_run (ksm_scan_thread,NULL ,"ksmd" );if (IS_ERR (ksm_thread)) { -printk (KERN_ERR "ksm: creating kthread failed\n" ); +pr_err (KERN_ERR "ksm: creating kthread failed\n" ); err =PTR_ERR (ksm_thread); goto out_free; }
mm/ksm.c static int __init ksm_init(void) · line 2324
Quoted 8 lines
mm/ksm.c +1
-1@@ -2318,7 +2318,7 @@ static int __init ksm_init(void)#ifdef CONFIG_SYSFS err =sysfs_create_group (mm_kobj, &ksm_attr_group);if (err) { -printk (KERN_ERR "ksm: register sysfs failed\n" ); +pr_err (KERN_ERR "ksm: register sysfs failed\n" );kthread_stop (ksm_thread); goto out_free; }
err,
mm/ksm.c renamed from mm/ksm.c~mm-ksm-use-pr_err-instead-of-printk-fix +2 -2
@@ -2310,7 +2310,7 @@ static int __init ksm_init(void) ksm_thread =kthread_run (ksm_scan_thread,NULL ,"ksmd" );if (IS_ERR (ksm_thread)) { -pr_err (KERN_ERR "ksm: creating kthread failed\n" ); +pr_err ("ksm: creating kthread failed\n" ); err =PTR_ERR (ksm_thread); goto out_free; }
@@ -2318,7 +2318,7 @@ static int __init ksm_init(void)#ifdef CONFIG_SYSFS err =sysfs_create_group (mm_kobj, &ksm_attr_group);if (err) { -pr_err (KERN_ERR "ksm: register sysfs failed\n" ); +pr_err ("ksm: register sysfs failed\n" );kthread_stop (ksm_thread); goto out_free; }
A quick grep indicates that we have the same mistake in tens of places. checkpatch rule, please?
Joe Perches
maintainerPATCH 1/1 checkpatch: Warn on logging functions with KERN_<LEVEL>
Warn on probable misuses of logging functions with KERN_<LEVEL> like pr_err(KERN_ERR "foo\n");
---
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +1
-1- printk(KERN_ERR "ksm: register sysfs failed\n"); + pr_err(KERN_ERR "ksm: register sysfs failed\n");A quick grep indicates that we have the same mistake in tens of places. checkpatch rule, please?
scripts/checkpatch.pl | 11 +++++++++++ 1 file changed, 11 insertions(+)
scripts/checkpatch.pl +11 -0
@@ -4447,6 +4447,17 @@ sub process { } } +# check for logging functions with KERN_<LEVEL> + if ($line !~ /printk\s*\(/ && + $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) { + my $level = $1; + if (WARN("UNNECESSARY_KERN_LEVEL", + "Possible unnecessary $level\n" . $herecurr) && + $fix) { + $fixed[$fixlinenr] =~ s/\s*$level\s*//; + } + } + # check for bad placement of section $InitAttribute (e.g.: __initdata) if ($line =~ /(\b$InitAttribute\b)/) { my $attr = $1;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>