From: Michael Ellerman <michael@ellerman.id.au>
To: linuxppc64-dev@ozlabs.org, netdev@oss.sgi.com,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/12] iseries_veth: Make init_connection() & destroy_connection() symmetrical
Date: Thu, 30 Jun 2005 20:20:39 +1000 [thread overview]
Message-ID: <1120126839.290253.340047065213.qpatch@concordia> (raw)
In-Reply-To: <200506302016.55125.michael@ellerman.id.au>
This patch makes veth_init_connection() and veth_destroy_connection()
symmetrical in that they allocate/deallocate the same data.
Currently if there's an error while initialising connections (ie. ENOMEM)
we call veth_module_cleanup(), however this will oops because we call
driver_unregister() before we've called driver_register(). I've never seen
this actually happen though.
So instead we explicitly call veth_destroy_connection() in a reverse
loop for the connections we've successfully initialised.
---
drivers/net/iseries_veth.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
Index: veth-dev/drivers/net/iseries_veth.c
===================================================================
--- veth-dev.orig/drivers/net/iseries_veth.c
+++ veth-dev/drivers/net/iseries_veth.c
@@ -664,6 +664,14 @@ static void veth_stop_connection(u8 rlp)
* been deleted by the state machine, just want to make sure
* its not running any more */
del_timer_sync(&cnx->ack_timer);
+}
+
+static void veth_destroy_connection(u8 rlp)
+{
+ struct veth_lpar_connection *cnx = veth_cnx[rlp];
+
+ if (! cnx)
+ return;
if (cnx->num_events > 0)
mf_deallocate_lp_events(cnx->remote_lp,
@@ -675,14 +683,6 @@ static void veth_stop_connection(u8 rlp)
HvLpEvent_Type_VirtualLan,
cnx->num_ack_events,
NULL, NULL);
-}
-
-static void veth_destroy_connection(u8 rlp)
-{
- struct veth_lpar_connection *cnx = veth_cnx[rlp];
-
- if (! cnx)
- return;
kfree(cnx->msgs);
kfree(cnx);
@@ -1424,15 +1424,15 @@ module_exit(veth_module_cleanup);
int __init veth_module_init(void)
{
- int i;
- int rc;
+ int i, rc;
this_lp = HvLpConfig_getLpIndex_outline();
for (i = 0; i < HVMAXARCHITECTEDLPS; ++i) {
rc = veth_init_connection(i);
if (rc != 0) {
- veth_module_cleanup();
+ for (; i >= 0; i--)
+ veth_destroy_connection(i);
return rc;
}
}
next prev parent reply other threads:[~2005-06-30 10:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-30 10:16 [RFC/PATCH 0/12] Updates & bug fixes for iseries_veth network driver Michael Ellerman
2005-06-30 10:20 ` [PATCH 8/12] iseries_veth: Replace lock-protected atomic with an ordinary variable Michael Ellerman
2005-06-30 10:20 ` [PATCH 7/12] iseries_veth: Remove redundant message stack lock Michael Ellerman
2005-06-30 10:20 ` [PATCH 9/12] iseries_veth: Use ref counts to track lifecycle of connection structs Michael Ellerman
2005-06-30 10:20 ` Michael Ellerman [this message]
2005-06-30 10:20 ` [PATCH 5/12] iseries_veth: Try to avoid pathological reset behaviour Michael Ellerman
2005-06-30 10:20 ` [PATCH 6/12] iseries_veth: Fix broken promiscuous handling Michael Ellerman
2005-06-30 10:20 ` [PATCH 10/12] iseries_veth: Remove TX timeout code Michael Ellerman
2005-06-30 10:20 ` [PATCH 2/12] iseries_veth: Cleanup error and debug messages Michael Ellerman
2005-06-30 10:20 ` [PATCH 1/12] iseries_veth: Make error messages more user friendly, and add a debug macro Michael Ellerman
2005-06-30 10:20 ` [PATCH 4/12] iseries_veth: Remove a FIXME WRT deletion of the ack_timer Michael Ellerman
2005-06-30 10:20 ` [PATCH 12/12] iseries_veth: Simplify full-queue handling Michael Ellerman
2005-06-30 10:20 ` [PATCH 11/12] iseries_veth: Add a per-connection ack timer Michael Ellerman
2005-06-30 14:41 ` [RFC/PATCH 0/12] Updates & bug fixes for iseries_veth network driver Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1120126839.290253.340047065213.qpatch@concordia \
--to=michael@ellerman.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc64-dev@ozlabs.org \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®