From: walter harms <wharms@bfs.de>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] bonding/bond_main.c: check return value of
Date: Sat, 25 Feb 2006 11:53:45 +0000 [thread overview]
Message-ID: <44004549.6000203@bfs.de> (raw)
In-Reply-To: <43E20B2F.8050109@bfs.de>
hi list,
my next improved patch. please note
* struct net_device *bond_dev=NULL; to prevend gcc from complaining
* max_bonds is atleast 1 so i should be initialised always
* better error handling (freeing ALL resources in case of error now)
* KERN_ERR instead of KERN_WARNING
The driver does no unregister_netdevice() i did not understand why so i
left it in this state. The two labels are not a mistake they simply
illustrate that this is an error exit for two different errors.
alexey, if you realy do not like it, simple remove them.
re,
walter
Signed-off-by: walter harms <wharms@bfs.de>
--- linux-2.6.15.4/drivers/net/bonding/bond_main.c.bak 2006-02-10
08:22:48.000000000 +0100
+++ linux-2.6.15.4/drivers/net/bonding/bond_main.c 2006-02-25
12:36:25.000000000 +0100
@@ -4884,6 +4884,7 @@
static int __init bonding_init(void)
{
struct bond_params params;
+ struct net_device *bond_dev=NULL;
int i;
int res;
@@ -4901,7 +4902,7 @@
#endif
for (i = 0; i < max_bonds; i++) {
- struct net_device *bond_dev;
+
bond_dev = alloc_netdev(sizeof(struct bonding), "", ether_setup);
if (!bond_dev) {
@@ -4929,18 +4930,29 @@
res = register_netdevice(bond_dev);
if (res < 0) {
- bond_deinit(bond_dev);
- free_netdev(bond_dev);
- goto out_err;
+ goto out_no_netdevice;
}
}
rtnl_unlock();
- register_netdevice_notifier(&bond_netdev_notifier);
+ res = register_netdevice_notifier(&bond_netdev_notifier);
+ if (res < 0) {
+ printk( KERN_ERR DRV_NAME" register_netdevice_notifier failed\n");
+
+ goto out_no_nd_notifier;
+ }
+
+
register_inetaddr_notifier(&bond_inetaddr_notifier);
return 0;
+out_no_nd_notifier:
+
+out_no_netdevice:
+ bond_deinit(bond_dev);
+ free_netdev(bond_dev);
+
out_err:
/*
* rtnl_unlock() will run netdev_run_todo(), putting the
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2006-02-25 11:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-02 13:37 [KJ] bonding/bond_main.c: check return value of walter harms
2006-02-20 21:09 ` Alexey Dobriyan
2006-02-25 11:53 ` walter harms [this message]
2006-02-25 12:13 ` Jesper Juhl
2006-02-25 12:31 ` Tim Cooijmans
2006-02-25 12:40 ` walter harms
2006-02-25 12:52 ` Jesper Juhl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44004549.6000203@bfs.de \
--to=wharms@bfs.de \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.