Commit 0b651772 authored by Ursula Braun's avatar Ursula Braun Committed by Sasha Levin

s390/qeth: handle sysfs error during initialization

[ Upstream commit 9111e788 ]

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: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
[jwi: updated commit msg, moved an OSN change to a subsequent patch]
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 4e0ecb77
...@@ -5603,8 +5603,10 @@ static int qeth_core_set_online(struct ccwgroup_device *gdev) ...@@ -5603,8 +5603,10 @@ static int qeth_core_set_online(struct ccwgroup_device *gdev)
if (rc) if (rc)
goto err; goto err;
rc = card->discipline->setup(card->gdev); rc = card->discipline->setup(card->gdev);
if (rc) if (rc) {
qeth_core_free_discipline(card);
goto err; goto err;
}
} }
rc = card->discipline->set_online(gdev); rc = card->discipline->set_online(gdev);
err: err:
......
...@@ -457,6 +457,8 @@ static ssize_t qeth_dev_layer2_store(struct device *dev, ...@@ -457,6 +457,8 @@ static ssize_t qeth_dev_layer2_store(struct device *dev,
goto out; goto out;
rc = card->discipline->setup(card->gdev); rc = card->discipline->setup(card->gdev);
if (rc)
qeth_core_free_discipline(card);
out: out:
mutex_unlock(&card->discipline_mutex); mutex_unlock(&card->discipline_mutex);
return rc ? rc : count; return rc ? rc : count;
......
...@@ -881,8 +881,11 @@ static int qeth_l2_stop(struct net_device *dev) ...@@ -881,8 +881,11 @@ static int qeth_l2_stop(struct net_device *dev)
static int qeth_l2_probe_device(struct ccwgroup_device *gdev) static int qeth_l2_probe_device(struct ccwgroup_device *gdev)
{ {
struct qeth_card *card = dev_get_drvdata(&gdev->dev); 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); INIT_LIST_HEAD(&card->vid_list);
INIT_LIST_HEAD(&card->mc_list); INIT_LIST_HEAD(&card->mc_list);
card->options.layer2 = 1; card->options.layer2 = 1;
......
...@@ -3342,8 +3342,11 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) ...@@ -3342,8 +3342,11 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
static int qeth_l3_probe_device(struct ccwgroup_device *gdev) static int qeth_l3_probe_device(struct ccwgroup_device *gdev)
{ {
struct qeth_card *card = dev_get_drvdata(&gdev->dev); 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->options.layer2 = 0;
card->info.hwtrap = 0; card->info.hwtrap = 0;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment