Skip to contentSkip to conversation

char: misc: use pr_err instead of printk

PATCH In review Rahul Bedarkar 3 participants 3 messages Oct 11, 2014 – Oct 14, 2014 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 char: misc: use pr_err instead of printk

---
 drivers/char/misc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/char/misc.c +3 -3
index 75b6de9..a6b96b1 100644
@@ -280,12 +280,12 @@ static int __init misc_init(void)
 
 	err = -EIO;
 	if (register_chrdev(MISC_MAJOR,"misc",&misc_fops))
-		goto fail_printk;
+		goto fail_pr_err;
 	misc_class->devnode = misc_devnode;
 	return 0;
 
-fail_printk:
-	printk("unable to get major %d for misc devices\n", MISC_MAJOR);
+fail_pr_err:
+	pr_err("unable to get major %d for misc devices\n", MISC_MAJOR);
 	class_destroy(misc_class);
 fail_remove:
 	remove_proc_entry("misc", NULL);
Signature · 1 line
1.8.3.2
#1 lore raw

On Sun, 2014-10-12 at 00:01 +0530, Rahul Bedarkar wrote:
[]

drivers/char/misc.c

Quoted 1 line
drivers/char/misc.c +0 -0

[]

Quoted 6 lines
drivers/char/misc.c +1 -1
@@ -280,12 +280,12 @@ static int __init misc_init(void)
 
 	err = -EIO;
 	if (register_chrdev(MISC_MAJOR,"misc",&misc_fops))
-		goto fail_printk;
+		goto fail_pr_err;

drivers/char/misc.c static int __init misc_init(void) · line 291

Quoted 10 lines
drivers/char/misc.c +2 -2
 	misc_class->devnode = misc_devnode;
 	return 0;
 
-fail_printk:
-	printk("unable to get major %d for misc devices\n", MISC_MAJOR);
+fail_pr_err:
+	pr_err("unable to get major %d for misc devices\n", MISC_MAJOR);
 	class_destroy(misc_class);
 fail_remove:
 	remove_proc_entry("misc", NULL);

The printk is not relevant.
Maybe the label should be "fail_destroy:"

#2 lore raw
Quoted 13 lines · Joe Perches

On Sun, 2014-10-12 at 00:01 +0530, Rahul Bedarkar wrote:
[]

drivers/char/misc.c

Quoted 1 line
drivers/char/misc.c +0 -0

[]

Quoted 9 lines
drivers/char/misc.c +1 -1
@@ -280,12 +280,12 @@ static int __init misc_init(void)
 
      err = -EIO;
      if (register_chrdev(MISC_MAJOR,"misc",&misc_fops))
-             goto fail_printk;
+             goto fail_pr_err;
      misc_class->devnode = misc_devnode;
      return 0;
 
Quoted 10 lines

drivers/char/misc.c static int __init misc_init(void) · line 291

Quoted 7 lines
drivers/char/misc.c +2 -2
-fail_printk:
-     printk("unable to get major %d for misc devices\n", MISC_MAJOR);
+fail_pr_err:
+     pr_err("unable to get major %d for misc devices\n", MISC_MAJOR);
      class_destroy(misc_class);
 fail_remove:
      remove_proc_entry("misc", NULL);

The printk is not relevant.
Maybe the label should be "fail_destroy:"

Ok. I will split this in two separate patches one renames label first and other use pr_err instead of printk. I will resend this patch

Thanks,
Rahul

Quoted 1 line