* [KJ] [PATCH][RESEND] misc_register : arch/x86_64/kernel/mce.c
@ 2006-10-02 12:16 Christophe Lucas
2006-10-03 4:27 ` Amol Lad
0 siblings, 1 reply; 2+ messages in thread
From: Christophe Lucas @ 2006-10-02 12:16 UTC (permalink / raw)
To: kernel-janitors
Description:
Audit return codes (and handle failure correctly) for misc_register.
Signed-off-by: Christophe Lucas <clucas@rotomalug.org>
Index: linux-2.6.18/arch/x86_64/kernel/mce.c
=================================--- linux-2.6.18.orig/arch/x86_64/kernel/mce.c 2006-10-02 13:57:17.000000000 +0200
+++ linux-2.6.18/arch/x86_64/kernel/mce.c 2006-10-02 13:57:58.000000000 +0200
@@ -663,7 +663,9 @@
}
register_hotcpu_notifier(&mce_cpu_notifier);
- misc_register(&mce_log_device);
+ err = misc_register(&mce_log_device);
+ if (err < 0)
+ printk(KERN_ERR "Failed to register mce.\n");
return err;
}
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [KJ] [PATCH][RESEND] misc_register : arch/x86_64/kernel/mce.c
2006-10-02 12:16 [KJ] [PATCH][RESEND] misc_register : arch/x86_64/kernel/mce.c Christophe Lucas
@ 2006-10-03 4:27 ` Amol Lad
0 siblings, 0 replies; 2+ messages in thread
From: Amol Lad @ 2006-10-03 4:27 UTC (permalink / raw)
To: kernel-janitors
> - misc_register(&mce_log_device);
> + err = misc_register(&mce_log_device);
> + if (err < 0)
> + printk(KERN_ERR "Failed to register mce.\n");
> return err;
Failure of misc_register not necessarily means that the calling function
should return an error. There are two possible cases:
1. Programmer deliberately left of misc_register return check as he
thought the error is not critical. Here you may want to just print a
warning message. (like arch/i386/kernel/apm.c)
2. Bug. This is where you need to return error.
Now the challenge is to differentiate between 1 & 2.
Good luck
> }
>
> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> https://lists.osdl.org/mailman/listinfo/kernel-janitors
>
>
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-10-03 4:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-02 12:16 [KJ] [PATCH][RESEND] misc_register : arch/x86_64/kernel/mce.c Christophe Lucas
2006-10-03 4:27 ` Amol Lad
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.