s390/qeth: handle error when updating TX queue count
authorJulian Wiedmann <jwi@linux.ibm.com>
Wed, 5 Jun 2019 11:48:51 +0000 (13:48 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Jun 2019 18:48:57 +0000 (11:48 -0700)
netif_set_real_num_tx_queues() can return an error, deal with it.

Fixes: 73dc2daf110f ("s390/qeth: add TX multiqueue support for OSA devices")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_core_main.c

index 009f2c0..b1823d7 100644 (file)
@@ -1274,16 +1274,20 @@ static int qeth_setup_channel(struct qeth_channel *channel, bool alloc_buffers)
        return 0;
 }
 
-static void qeth_osa_set_output_queues(struct qeth_card *card, bool single)
+static int qeth_osa_set_output_queues(struct qeth_card *card, bool single)
 {
        unsigned int count = single ? 1 : card->dev->num_tx_queues;
+       int rc;
 
        rtnl_lock();
-       netif_set_real_num_tx_queues(card->dev, count);
+       rc = netif_set_real_num_tx_queues(card->dev, count);
        rtnl_unlock();
 
+       if (rc)
+               return rc;
+
        if (card->qdio.no_out_queues == count)
-               return;
+               return 0;
 
        if (atomic_read(&card->qdio.state) != QETH_QDIO_UNINITIALIZED)
                qeth_free_qdio_queues(card);
@@ -1293,12 +1297,14 @@ static void qeth_osa_set_output_queues(struct qeth_card *card, bool single)
 
        card->qdio.default_out_queue = single ? 0 : QETH_DEFAULT_QUEUE;
        card->qdio.no_out_queues = count;
+       return 0;
 }
 
 static int qeth_update_from_chp_desc(struct qeth_card *card)
 {
        struct ccw_device *ccwdev;
        struct channel_path_desc_fmt0 *chp_dsc;
+       int rc = 0;
 
        QETH_DBF_TEXT(SETUP, 2, "chp_desc");
 
@@ -1311,12 +1317,12 @@ static int qeth_update_from_chp_desc(struct qeth_card *card)
 
        if (IS_OSD(card) || IS_OSX(card))
                /* CHPP field bit 6 == 1 -> single queue */
-               qeth_osa_set_output_queues(card, chp_dsc->chpp & 0x02);
+               rc = qeth_osa_set_output_queues(card, chp_dsc->chpp & 0x02);
 
        kfree(chp_dsc);
        QETH_DBF_TEXT_(SETUP, 2, "nr:%x", card->qdio.no_out_queues);
        QETH_DBF_TEXT_(SETUP, 2, "lvl:%02x", card->info.func_level);
-       return 0;
+       return rc;
 }
 
 static void qeth_init_qdio_info(struct qeth_card *card)
@@ -5597,8 +5603,12 @@ static struct net_device *qeth_alloc_netdev(struct qeth_card *card)
                dev->hw_features |= NETIF_F_SG;
                dev->vlan_features |= NETIF_F_SG;
                if (IS_IQD(card)) {
-                       netif_set_real_num_tx_queues(dev, QETH_IQD_MIN_TXQ);
                        dev->features |= NETIF_F_SG;
+                       if (netif_set_real_num_tx_queues(dev,
+                                                        QETH_IQD_MIN_TXQ)) {
+                               free_netdev(dev);
+                               return NULL;
+                       }
                }
        }