[PATCH] hp_sdc_rtc.c: audit return codes From: Christophe Lucas Audit return codes (and handle failure correctly) for misc_register and create_proc_read_entry. Signed-off-by: Christophe Lucas Signed-off-by: Alexey Dobriyan Index: linux-kj/drivers/input/misc/hp_sdc_rtc.c =================================================================== --- linux-kj.orig/drivers/input/misc/hp_sdc_rtc.c 2005-09-21 01:19:23.000000000 +0400 +++ linux-kj/drivers/input/misc/hp_sdc_rtc.c 2005-09-21 01:25:42.000000000 +0400 @@ -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");