• Matvejchikov Ilya's avatar
    slip: remove dead code within the slip initialization · 390fd0b3
    Matvejchikov Ilya authored
    This following code contains a dead "if (dev).." block:
            ...
            for (i = 0; i < slip_maxdev; i++) {
                    dev = slip_devs[i];
                    if (dev == NULL)
                            break;
            }
            /* Sorry, too many, all slots in use */
            if (i >= slip_maxdev)
                    return NULL;
    
            if (dev) {
                    sl = netdev_priv(dev);
                    if (test_bit(SLF_INUSE, &sl->flags)) {
                            unregister_netdevice(dev);
                            dev = NULL;
                            slip_devs[i] = NULL;
                    }
             }
            ...
    The reason is that the code starting with "if (dev).." is never called as
    when we found an empty slot (dev == NULL) we break the loop and "if (dev).."
    not works eiter the loop ends and we get out with "i >= slip_maxdev".
    Signed-off-by: default avatarMatvejchikov Ilya <matvejchikov@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    390fd0b3
slip.c 33.4 KB