Commit a2eb0ad5 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: on gdev release, reset drvdata

qeth_core_probe_device() sets the gdev's drvdata, but doesn't reset it
on a subsequent error. Move the (re-)setting around a bit, so that it
happens symmetrically on allocating/freeing the qeth_card struct.

This is no actual problem, as the ccwgroup core will discard the gdev
on a probe error. But from qeth's perspective the gdev is an external
resource, so it's best to manage it cleanly.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c1a935f6
...@@ -1513,6 +1513,7 @@ static struct qeth_card *qeth_alloc_card(struct ccwgroup_device *gdev) ...@@ -1513,6 +1513,7 @@ static struct qeth_card *qeth_alloc_card(struct ccwgroup_device *gdev)
QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *)); QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
card->gdev = gdev; card->gdev = gdev;
dev_set_drvdata(&gdev->dev, card);
CARD_RDEV(card) = gdev->cdev[0]; CARD_RDEV(card) = gdev->cdev[0];
CARD_WDEV(card) = gdev->cdev[1]; CARD_WDEV(card) = gdev->cdev[1];
CARD_DDEV(card) = gdev->cdev[2]; CARD_DDEV(card) = gdev->cdev[2];
...@@ -1531,6 +1532,7 @@ static struct qeth_card *qeth_alloc_card(struct ccwgroup_device *gdev) ...@@ -1531,6 +1532,7 @@ static struct qeth_card *qeth_alloc_card(struct ccwgroup_device *gdev)
out_channel: out_channel:
qeth_clean_channel(&card->read); qeth_clean_channel(&card->read);
out_ip: out_ip:
dev_set_drvdata(&gdev->dev, NULL);
kfree(card); kfree(card);
out: out:
return NULL; return NULL;
...@@ -5074,6 +5076,7 @@ static void qeth_core_free_card(struct qeth_card *card) ...@@ -5074,6 +5076,7 @@ static void qeth_core_free_card(struct qeth_card *card)
qeth_clean_channel(&card->data); qeth_clean_channel(&card->data);
qeth_free_qdio_buffers(card); qeth_free_qdio_buffers(card);
unregister_service_level(&card->qeth_service_level); unregister_service_level(&card->qeth_service_level);
dev_set_drvdata(&card->gdev->dev, NULL);
kfree(card); kfree(card);
} }
...@@ -5788,7 +5791,6 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev) ...@@ -5788,7 +5791,6 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
goto err_card; goto err_card;
} }
dev_set_drvdata(&gdev->dev, card);
qeth_setup_card(card); qeth_setup_card(card);
qeth_update_from_chp_desc(card); qeth_update_from_chp_desc(card);
...@@ -5851,7 +5853,6 @@ static void qeth_core_remove_device(struct ccwgroup_device *gdev) ...@@ -5851,7 +5853,6 @@ static void qeth_core_remove_device(struct ccwgroup_device *gdev)
write_unlock_irq(&qeth_core_card_list.rwlock); write_unlock_irq(&qeth_core_card_list.rwlock);
free_netdev(card->dev); free_netdev(card->dev);
qeth_core_free_card(card); qeth_core_free_card(card);
dev_set_drvdata(&gdev->dev, NULL);
put_device(&gdev->dev); put_device(&gdev->dev);
} }
......
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