* [PATCH] wanmain: comparing array with NULL
@ 2012-07-24 18:16 Alan Cox
2012-07-24 20:57 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Alan Cox @ 2012-07-24 18:16 UTC (permalink / raw)
To: netdev
From: Alan Cox <alan@linux.intel.com>
gcc really should warn about these !
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
net/wanrouter/wanmain.c | 51 +++++++++++++++++++++--------------------------
1 file changed, 23 insertions(+), 28 deletions(-)
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index 788a12c..23d6569 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -602,36 +602,31 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
* successfully, add it to the interface list.
*/
- if (dev->name == NULL) {
- err = -EINVAL;
- } else {
-
- #ifdef WANDEBUG
- printk(KERN_INFO "%s: registering interface %s...\n",
+#ifdef WANDEBUG
+ printk(KERN_INFO "%s: registering interface %s...\n",
wanrouter_modname, dev->name);
- #endif
-
- err = register_netdev(dev);
- if (!err) {
- struct net_device *slave = NULL;
- unsigned long smp_flags=0;
-
- lock_adapter_irq(&wandev->lock, &smp_flags);
-
- if (wandev->dev == NULL) {
- wandev->dev = dev;
- } else {
- for (slave=wandev->dev;
- DEV_TO_SLAVE(slave);
- slave = DEV_TO_SLAVE(slave))
- DEV_TO_SLAVE(slave) = dev;
- }
- ++wandev->ndev;
-
- unlock_adapter_irq(&wandev->lock, &smp_flags);
- err = 0; /* done !!! */
- goto out;
+#endif
+
+ err = register_netdev(dev);
+ if (!err) {
+ struct net_device *slave = NULL;
+ unsigned long smp_flags=0;
+
+ lock_adapter_irq(&wandev->lock, &smp_flags);
+
+ if (wandev->dev == NULL) {
+ wandev->dev = dev;
+ } else {
+ for (slave=wandev->dev;
+ DEV_TO_SLAVE(slave);
+ slave = DEV_TO_SLAVE(slave))
+ DEV_TO_SLAVE(slave) = dev;
}
+ ++wandev->ndev;
+
+ unlock_adapter_irq(&wandev->lock, &smp_flags);
+ err = 0; /* done !!! */
+ goto out;
}
if (wandev->del_if)
wandev->del_if(wandev, dev);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] wanmain: comparing array with NULL
2012-07-24 18:16 [PATCH] wanmain: comparing array with NULL Alan Cox
@ 2012-07-24 20:57 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-07-24 20:57 UTC (permalink / raw)
To: alan; +Cc: netdev
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
Date: Tue, 24 Jul 2012 19:16:25 +0100
> From: Alan Cox <alan@linux.intel.com>
>
> gcc really should warn about these !
>
> Signed-off-by: Alan Cox <alan@linux.intel.com>
Applied and queued up for -stable.
> + printk(KERN_INFO "%s: registering interface %s...\n",
> wanrouter_modname, dev->name);
I adjusted the indentation of the second line, as needed.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-24 20:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-24 18:16 [PATCH] wanmain: comparing array with NULL Alan Cox
2012-07-24 20:57 ` David Miller
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.