public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jaswinder Singh <jaswinder@infradead.org>
To: David Dillow <dave@thedillows.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	becker@scyld.com, davidpmclean@yahoo.com,
	Jeff Garzik <jeff@garzik.org>, netdev <netdev@vger.kernel.org>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] typhoon: use request_firmware
Date: Wed, 30 Jul 2008 12:14:11 +0530	[thread overview]
Message-ID: <1217400251.2595.3.camel@jaswinder.satnam> (raw)
In-Reply-To: <1217395511.31350.6.camel@obelisk.thedillows.org>

Hello Dave,

On Wed, 2008-07-30 at 01:25 -0400, David Dillow wrote:

> That's fine, and makes sense. However, you need to check if you've
> already loaded it (typhoon_fw != NULL), so you don't leak memory if
> there is more than one NIC. Part of me feels like there should be a
> mutex around loading the firmware, to avoid surprises if PCI probing
> gets multi-threaded again, but a comment to that effect may suffice for
> now.
> 

OK, fixed.

diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index a57941a..50f1943 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -2461,9 +2461,17 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	 */
 	tp->name = pci_name(pdev);
 
-	err = typhoon_init_firmware(tp);
-	if (err)
-		goto error_out_reset;
+	/*
+	 * Need to check request_firmware should be called only once
+	 * so you don't leak memory if there is more than one NIC.
+	 * Need to check if PCI probing gets multi-threaded as
+	 * mutex is used while loading the firmware.
+	 */
+	if (typhoon_fw != NULL) {
+		err = typhoon_init_firmware(tp);
+		if (err)
+			goto error_out_reset;
+	}
 
 	typhoon_init_interface(tp);
 	typhoon_init_rings(tp);

> Also, if not adding a mutex, then this can be folded into
> typhoon_init_one(), rather than living in a separate function. 
> 

request_firmware is using mutex.

> All in all, this is getting better, my reservations about the goal
> aside.
> 

Without you help this was not possible :)

Thank you,

Jaswinder Singh.


  reply	other threads:[~2008-07-30  6:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-27 14:50 [PATCH] typhoon: use request_firmware Jaswinder Singh
2008-07-28  1:43 ` David Dillow
2008-07-28  3:16   ` Jaswinder Singh
2008-07-28 12:36     ` David Dillow
2008-07-28 13:54       ` Jaswinder Singh
2008-07-29  1:38         ` David Dillow
2008-07-29  3:57           ` David Dillow
2008-07-29 16:09           ` Jaswinder Singh
2008-07-30  5:25             ` David Dillow
2008-07-30  6:44               ` Jaswinder Singh [this message]
2008-07-31  3:37                 ` David Dillow
2008-07-31  7:42                   ` David Woodhouse

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=1217400251.2595.3.camel@jaswinder.satnam \
    --to=jaswinder@infradead.org \
    --cc=becker@scyld.com \
    --cc=dave@thedillows.org \
    --cc=davidpmclean@yahoo.com \
    --cc=dwmw2@infradead.org \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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