* [KJ] hamradio/bpqether.c: check return value of
@ 2006-02-02 13:35 walter harms
2006-02-04 17:50 ` Alexey Dobriyan
0 siblings, 1 reply; 2+ messages in thread
From: walter harms @ 2006-02-02 13:35 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 871 bytes --]
check the return value of register_netdevice_notifier()
also as attachment if something mangels the layout.
compile tested
Signed-off-by: walter harms <wharms@bfs.de>
--- linux/drivers/net/hamradio/bpqether.c.bak 2006-02-01
22:13:07.000000000 +0100
+++ linux/drivers/net/hamradio/bpqether.c 2006-02-01 22:30:16.000000000
+0100
@@ -595,6 +595,7 @@
*/
static int __init bpq_init_driver(void)
{
+ int ret;
#ifdef CONFIG_PROC_FS
if (!proc_net_fops_create("bpqether", S_IRUGO, &bpq_info_fops)) {
printk(KERN_ERR
@@ -605,7 +606,12 @@
dev_add_pack(&bpq_packet_type);
- register_netdevice_notifier(&bpq_dev_notifier);
+ ret = register_netdevice_notifier(&bpq_dev_notifier);
+ if (ret < 0) {
+ printk( KERN_WARNING "register_netdevice_notifier failed in
%s\n",__FUNCTION__);
+ dev_remove_pack(&bpq_packet_type);
+ return -1;
+ }
printk(banner);
[-- Attachment #2: bpqether.c.diff --]
[-- Type: text/x-patch, Size: 694 bytes --]
--- linux/drivers/net/hamradio/bpqether.c.bak 2006-02-01 22:13:07.000000000 +0100
+++ linux/drivers/net/hamradio/bpqether.c 2006-02-01 22:30:16.000000000 +0100
@@ -595,6 +595,7 @@
*/
static int __init bpq_init_driver(void)
{
+ int ret;
#ifdef CONFIG_PROC_FS
if (!proc_net_fops_create("bpqether", S_IRUGO, &bpq_info_fops)) {
printk(KERN_ERR
@@ -605,7 +606,12 @@
dev_add_pack(&bpq_packet_type);
- register_netdevice_notifier(&bpq_dev_notifier);
+ ret = register_netdevice_notifier(&bpq_dev_notifier);
+ if (ret < 0) {
+ printk( KERN_WARNING "register_netdevice_notifier failed in %s\n",__FUNCTION__);
+ dev_remove_pack(&bpq_packet_type);
+ return -1;
+ }
printk(banner);
[-- Attachment #3: Type: text/plain, Size: 168 bytes --]
_______________________________________________
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] hamradio/bpqether.c: check return value of
2006-02-02 13:35 [KJ] hamradio/bpqether.c: check return value of walter harms
@ 2006-02-04 17:50 ` Alexey Dobriyan
0 siblings, 0 replies; 2+ messages in thread
From: Alexey Dobriyan @ 2006-02-04 17:50 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 737 bytes --]
> --- linux/drivers/net/hamradio/bpqether.c.bak
> +++ linux/drivers/net/hamradio/bpqether.c
> @@ -595,6 +595,7 @@
> */
> static int __init bpq_init_driver(void)
> {
> + int ret;
> #ifdef CONFIG_PROC_FS
> if (!proc_net_fops_create("bpqether", S_IRUGO, &bpq_info_fops)) {
> printk(KERN_ERR
> @@ -605,7 +606,12 @@
>
> dev_add_pack(&bpq_packet_type);
>
> - register_netdevice_notifier(&bpq_dev_notifier);
> + ret = register_netdevice_notifier(&bpq_dev_notifier);
> + if (ret < 0) {
> + printk( KERN_WARNING "register_netdevice_notifier failed in %s\n",__FUNCTION__);
> + dev_remove_pack(&bpq_packet_type);
> + return -1;
> + }
Looks good except proc_net_fops_create() should be reversed, KERN_ERR,
and not return -1 always.
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
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-02-04 17:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-02 13:35 [KJ] hamradio/bpqether.c: check return value of walter harms
2006-02-04 17:50 ` Alexey Dobriyan
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.