drivers/char/mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Fix a typo in the comment of read_mem(): funcion -> function
Replace a raw printk() call in chr_dev_init() with pr_err().
The original call lacked a log level, which is discouraged.
Using pr_err() ensures the error is properly categorized and
follows modern logging practices.
Signed-off-by: Minu Jin <s9430939@naver.com>
---
drivers/char/mem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 52039fae1594..4c6bb10d1508 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -76,7 +76,7 @@ static inline bool should_stop_iteration(void)
}
/*
- * This funcion reads the *physical* memory. The f_pos points directly to the
+ * This function reads the *physical* memory. The f_pos points directly to the
* memory location.
*/
static ssize_t read_mem(struct file *file, char __user *buf,
@@ -765,7 +765,7 @@ static int __init chr_dev_init(void)
int minor;
if (register_chrdev(MEM_MAJOR, "mem", &memory_fops))
- printk("unable to get major %d for memory devs\n", MEM_MAJOR);
+ pr_err("unable to get major %d for memory devs\n", MEM_MAJOR);
retval = class_register(&mem_class);
if (retval)
--
2.43.0
On Fri, Jan 02, 2026 at 03:27:59PM +0900, Minu Jin wrote:
> Fix a typo in the comment of read_mem(): funcion -> function
>
> Replace a raw printk() call in chr_dev_init() with pr_err().
> The original call lacked a log level, which is discouraged.
>
> Using pr_err() ensures the error is properly categorized and
> follows modern logging practices.
This is two different things, it should be 2 different patches (yes, I'm
being pedantic, sorry, that's because:)
> if (register_chrdev(MEM_MAJOR, "mem", &memory_fops))
> - printk("unable to get major %d for memory devs\n", MEM_MAJOR);
> + pr_err("unable to get major %d for memory devs\n", MEM_MAJOR);
This change doesn't really do anything different, so it's not needed.
Let's leave it alone as it's been this way for decades.
thanks,
greg k-h
© 2016 - 2026 Red Hat, Inc.