[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090311084456.9190.52805.stgit@warthog.procyon.org.uk>
Date: Wed, 11 Mar 2009 08:44:57 +0000
From: David Howells <dhowells@...hat.com>
To: raisch@...ibm.com, themann@...ibm.com, tklein@...ibm.com
Cc: linuxppc-dev@...abs.org, dhowells@...hat.com,
netdev@...r.kernel.org
Subject: [PATCH] eHEA: Don't do memory allocation under lock if not necessary
In ehea_probe_adapter() the initial memory allocation and initialisation does
not need to be done with the ehea_fw_handles.lock semaphore held. Doing so
extends the amount of time the lock is held unnecessarily.
Signed-off-by: David Howells <dhowells@...hat.com>
---
drivers/net/ehea/ehea_main.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index dfe9226..34480ae 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -3370,18 +3370,19 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,
ehea_error("Invalid ibmebus device probed");
return -EINVAL;
}
- mutex_lock(&ehea_fw_handles.lock);
adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
if (!adapter) {
- ret = -ENOMEM;
dev_err(&dev->dev, "no mem for ehea_adapter\n");
- goto out;
+ return -ENOMEM;
}
- list_add(&adapter->list, &adapter_list);
-
adapter->ofdev = dev;
+ adapter->pd = EHEA_PD_ID;
+
+ mutex_lock(&ehea_fw_handles.lock);
+
+ list_add(&adapter->list, &adapter_list);
adapter_handle = of_get_property(dev->node, "ibm,hea-handle",
NULL);
@@ -3395,8 +3396,6 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,
goto out_free_ad;
}
- adapter->pd = EHEA_PD_ID;
-
dev->dev.driver_data = adapter;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists