Skip to content

Commit

Permalink
s390/qeth: handle sysfs error during initialization
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ursula Braun authored and davem330 committed May 11, 2017
1 parent b601616 commit 9111e78
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion drivers/s390/net/qeth_core_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions drivers/s390/net/qeth_core_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion drivers/s390/net/qeth_l2_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion drivers/s390/net/qeth_l3_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9111e78

Please sign in to comment.