mac802154: remove unnecessary if statement
authorVarka Bhadram <varkabhadram@gmail.com>
Tue, 25 Nov 2014 11:04:43 +0000 (16:34 +0530)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 26 Nov 2014 05:00:13 +0000 (06:00 +0100)
Removes unnecessary if statement check for net device. Error check performed
after alloc_netdev().

ndev = alloc_netdev(sizeof(*sdata) + local->hw.vif_data_size, name,
    NET_NAME_UNKNOWN, ieee802154_if_setup);
        if (!ndev)
                return ERR_PTR(-ENOMEM);
..

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/mac802154/iface.c

index 38dfc72d24b689483facf8404d12970978cb3e56..9ae893057dd761e4e82f563b9f24b4c59e6254bc 100644 (file)
@@ -510,11 +510,9 @@ ieee802154_if_add(struct ieee802154_local *local, const char *name,
        if (ret)
                goto err;
 
-       if (ndev) {
-               ret = register_netdevice(ndev);
-               if (ret < 0)
-                       goto err;
-       }
+       ret = register_netdevice(ndev);
+       if (ret < 0)
+               goto err;
 
        mutex_lock(&local->iflist_mtx);
        list_add_tail_rcu(&sdata->list, &local->interfaces);