qeth: Fix retry logic in hardsetup
[cascardo/linux.git] / drivers / s390 / net / qeth_core_main.c
index 638a57f..1ea6b70 100644 (file)
@@ -4765,14 +4765,14 @@ static struct ccw_driver qeth_ccw_driver = {
 
 int qeth_core_hardsetup_card(struct qeth_card *card)
 {
-       int retries = 0;
+       int retries = 3;
        int rc;
 
        QETH_DBF_TEXT(SETUP, 2, "hrdsetup");
        atomic_set(&card->force_alloc_skb, 0);
        qeth_update_from_chp_desc(card);
 retry:
-       if (retries)
+       if (retries < 3)
                QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n",
                        dev_name(&card->gdev->dev));
        ccw_device_set_offline(CARD_DDEV(card));
@@ -4794,7 +4794,7 @@ retriable:
                return rc;
        } else if (rc) {
                QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
-               if (++retries > 3)
+               if (--retries < 0)
                        goto out;
                else
                        goto retry;
@@ -5444,17 +5444,14 @@ void qeth_core_get_drvinfo(struct net_device *dev,
                struct ethtool_drvinfo *info)
 {
        struct qeth_card *card = dev->ml_priv;
-       if (card->options.layer2)
-               strcpy(info->driver, "qeth_l2");
-       else
-               strcpy(info->driver, "qeth_l3");
-
-       strcpy(info->version, "1.0");
-       strcpy(info->fw_version, card->info.mcl_level);
-       sprintf(info->bus_info, "%s/%s/%s",
-                       CARD_RDEV_ID(card),
-                       CARD_WDEV_ID(card),
-                       CARD_DDEV_ID(card));
+
+       strlcpy(info->driver, card->options.layer2 ? "qeth_l2" : "qeth_l3",
+               sizeof(info->driver));
+       strlcpy(info->version, "1.0", sizeof(info->version));
+       strlcpy(info->fw_version, card->info.mcl_level,
+               sizeof(info->fw_version));
+       snprintf(info->bus_info, sizeof(info->bus_info), "%s/%s/%s",
+                CARD_RDEV_ID(card), CARD_WDEV_ID(card), CARD_DDEV_ID(card));
 }
 EXPORT_SYMBOL_GPL(qeth_core_get_drvinfo);