Skip to contentSkip to conversation

Audit return code : drivers/macintosh/apm_emu.c

PATCH In review [email protected] 3 participants 3 messages Jun 30, 2005 – Jul 1, 2005 Linux for power macintosh

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Audit return code : drivers/macintosh/apm_emu.c

From: Christophe Lucas <[email protected]>

Audit return codes (and handle failure correctly) for misc_register.

---
 apm_emu.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
drivers/macintosh/apm_emu.c +8 -3
Index: quilt/drivers/macintosh/apm_emu.c
===================================================================
@@ -515,19 +515,24 @@ static struct miscdevice apm_device = {
 
 static int __init apm_emu_init(void)
 {
+	int ret;
 	struct proc_dir_entry *apm_proc;
 
 	if (sys_ctrler != SYS_CTRLER_PMU) {
 		printk(KERN_INFO "apm_emu: Requires a machine with a PMU.\n");
 		return -ENODEV;
 	}
-		
+
+	ret = misc_register(&apm_device);
+	if (ret) {
+		printk(KERN_WARNING "apm_emu: Unable to register misc device.\n");
+		return ret;
+	}
+
 	apm_proc = create_proc_info_entry("apm", 0, NULL, apm_emu_get_info);
 	if (apm_proc)
 		apm_proc->owner = THIS_MODULE;
 
-	misc_register(&apm_device);
-
 	pmu_register_sleep_notifier(&apm_sleep_notifier);
 
 	printk(KERN_INFO "apm_emu: APM Emulation %s initialized.\n", driver_version);

--

#1 lore raw
Quoted 5 lines · On Fri, 01 Jul 2005 00:03:50 +0200 [email protected] wrote:

From: Christophe Lucas <[email protected]>

Audit return codes (and handle failure correctly) for misc_register.

This patch was rejected against arch/i386/kernel/apm.c since the driver can still do useful things even if the misc_register fails. (I don't know if this is true for the ppc emulation, just a note).

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#2 lore raw
Quoted 10 lines · Stephen Rothwell
Quoted 5 lines · On Fri, 01 Jul 2005 00:03:50 +0200 [email protected] wrote:

From: Christophe Lucas <[email protected]>

Audit return codes (and handle failure correctly) for misc_register.

This patch was rejected against arch/i386/kernel/apm.c since the driver can still do useful things even if the misc_register fails. (I don't know if this is true for the ppc emulation, just a note).

Yes same for ppc, we still have the /proc entry which is useful.

Ben.