Commit 73ef1072 authored by Chris Wilson's avatar Chris Wilson Committed by Linus Torvalds

[PATCH] ip27-rtc.c create_proc_read_entry patch

  As part of my work on the Linux Kernel Janitors project, cleaning up on
  functions which call create_proc_*_entry and don't check for an error
  return, I would like to submit my patch to arch/mips64/sgi-ip27/ip27-rtc.c.

  This patch adds a printk() if misc_register fails (since that causes the
  driver to fail to load, it should be logged somewhere), and checks that
  create_proc_read_entry returned a valid handle. ENOENT seems to me like a
  good error code to return in this case, although EBUSY is a candidate too.
parent e3ffd6b0
...@@ -202,9 +202,15 @@ static int __init rtc_init(void) ...@@ -202,9 +202,15 @@ static int __init rtc_init(void)
KL_CONFIG_CH_CONS_INFO(nid)->memory_base + IOC3_BYTEBUS_DEV0; KL_CONFIG_CH_CONS_INFO(nid)->memory_base + IOC3_BYTEBUS_DEV0;
printk(KERN_INFO "Real Time Clock Driver v%s\n", RTC_VERSION); printk(KERN_INFO "Real Time Clock Driver v%s\n", RTC_VERSION);
if (misc_register(&rtc_dev)) if (misc_register(&rtc_dev)) {
printk(KERN_ERR "rtc: cannot register misc device.\n");
return -ENODEV; return -ENODEV;
create_proc_read_entry ("rtc", 0, NULL, rtc_read_proc, NULL); }
if (!create_proc_read_entry ("rtc", 0, NULL, rtc_read_proc, NULL)) {
printk(KERN_ERR "rtc: cannot create /proc/rtc.\n");
misc_deregister(&rtc_dev);
return -ENOENT;
}
save_flags(flags); save_flags(flags);
cli(); cli();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment