s390/qeth: unregister netdevice only when registered
qeth only registers its netdevice when the qeth device is first set
online. Thus a device that has never been set online will trigger
a WARN ("network todo 'hsi%d' but state 0") in unregister_netdev() when
removed.
Fix this by protecting the unregister step, just like we already protect
against repeated registering of the netdevice.
Fixes: d3d1b205e8
("s390/qeth: allocate netdevice early")
Reported-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
bd74a7f9cc
commit
30356d0815
@@ -826,7 +826,8 @@ static void qeth_l2_remove_device(struct ccwgroup_device *cgdev)
|
||||
|
||||
if (cgdev->state == CCWGROUP_ONLINE)
|
||||
qeth_l2_set_offline(cgdev);
|
||||
unregister_netdev(card->dev);
|
||||
if (qeth_netdev_is_registered(card->dev))
|
||||
unregister_netdev(card->dev);
|
||||
}
|
||||
|
||||
static const struct ethtool_ops qeth_l2_ethtool_ops = {
|
||||
@@ -866,7 +867,7 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (card->dev->netdev_ops)
|
||||
if (qeth_netdev_is_registered(card->dev))
|
||||
return 0;
|
||||
|
||||
card->dev->priv_flags |= IFF_UNICAST_FLT;
|
||||
|
Reference in New Issue
Block a user