From: Christophe Lucas Subject: [KJ] [PATCH] Audit return code : drivers/input/misc/hp_sdc_rtc.c Audit return codes (and handle failure correctly) for misc_register. Signed-off-by: Christophe Lucas --- hp_sdc_rtc.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) Index: quilt/drivers/input/misc/hp_sdc_rtc.c =================================================================== --- quilt.orig/drivers/input/misc/hp_sdc_rtc.c +++ quilt/drivers/input/misc/hp_sdc_rtc.c @@ -697,14 +697,24 @@ static struct miscdevice hp_sdc_rtc_dev static int __init hp_sdc_rtc_init(void) { int ret; + struct proc_dir_entry* proc_de; init_MUTEX(&i8042tregs); if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr))) return ret; - misc_register(&hp_sdc_rtc_dev); - create_proc_read_entry ("driver/rtc", 0, 0, + ret = misc_register(&hp_sdc_rtc_dev); + if (ret) { + printk(KERN_WARNING "hp_sdc_rtc: " + "Unable to register misc device.\n"); + return ret; + } + proc_de = create_proc_read_entry("driver/rtc", 0, 0, hp_sdc_rtc_read_proc, NULL); + if (proc_de == NULL) { + printk(KERN_WARNING "hp_sdc_rtc: " + "Unable to create proc dir entry.\n"); + } printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded " "(RTC v " RTC_VERSION ")\n");