s390/qeth: handle sysfs error during initialization
authorUrsula Braun <ubraun@linux.vnet.ibm.com>
Wed, 10 May 2017 17:07:51 +0000 (19:07 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 May 2017 16:37:48 +0000 (12:37 -0400)
When setting up the device from within the layer discipline's
probe routine, creating the layer-specific sysfs attributes can fail.
Report this error back to the caller, and handle it by
releasing the layer discipline.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
[jwi: updated commit msg, moved an OSN change to a subsequent patch]
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_core_sys.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c

index 38114a8d56e00f471360ab400767dcb8ba8a1a7b..5bfd7c15d6a9d83d5ee7442003c3f969f2febd1b 100644 (file)
@@ -5731,8 +5731,10 @@ static int qeth_core_set_online(struct ccwgroup_device *gdev)
                if (rc)
                        goto err;
                rc = card->discipline->setup(card->gdev);
-               if (rc)
+               if (rc) {
+                       qeth_core_free_discipline(card);
                        goto err;
+               }
        }
        rc = card->discipline->set_online(gdev);
 err:
index 75b29fd2fcf4eab64e82b23b1183fe88211d97ba..412ff61891ac0820d36650b232f4d80c97bdd8e7 100644 (file)
@@ -426,6 +426,8 @@ static ssize_t qeth_dev_layer2_store(struct device *dev,
                goto out;
 
        rc = card->discipline->setup(card->gdev);
+       if (rc)
+               qeth_core_free_discipline(card);
 out:
        mutex_unlock(&card->discipline_mutex);
        return rc ? rc : count;
index 1b07f382d74c955974d138271bdce2bbbf594f63..2d2623182abf88fd19625b09348a3d06a28f4e98 100644 (file)
@@ -883,8 +883,11 @@ static int qeth_l2_stop(struct net_device *dev)
 static int qeth_l2_probe_device(struct ccwgroup_device *gdev)
 {
        struct qeth_card *card = dev_get_drvdata(&gdev->dev);
+       int rc;
 
-       qeth_l2_create_device_attributes(&gdev->dev);
+       rc = qeth_l2_create_device_attributes(&gdev->dev);
+       if (rc)
+               return rc;
        INIT_LIST_HEAD(&card->vid_list);
        hash_init(card->mac_htable);
        card->options.layer2 = 1;
index 6e0354ef4b8629827e4c8ef40b9d569bc11e354b..ae70daf33bd53aef3c75717b73c860bdd9e8e262 100644 (file)
@@ -3039,8 +3039,11 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
 static int qeth_l3_probe_device(struct ccwgroup_device *gdev)
 {
        struct qeth_card *card = dev_get_drvdata(&gdev->dev);
+       int rc;
 
-       qeth_l3_create_device_attributes(&gdev->dev);
+       rc = qeth_l3_create_device_attributes(&gdev->dev);
+       if (rc)
+               return rc;
        card->options.layer2 = 0;
        card->info.hwtrap = 0;
        return 0;