mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaswinder Singh <jaswinder@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, dwmw2@infradead.org
Subject: Re: [PATCH] firmware: avoiding multiple replication for same firmware file
Date: Wed, 06 Aug 2008 15:16:23 +0530	[thread overview]
Message-ID: <1218015983.3044.10.camel@jaswinder.satnam> (raw)
In-Reply-To: <1218015313.3044.6.camel@jaswinder.satnam>

Sorry, minor correction.

On Wed, 2008-08-06 at 15:05 +0530, Jaswinder Singh wrote:
> +
> +	mutex_lock(&fw_lock);
> +	tmp = kzalloc(sizeof(struct firmware_list), GFP_KERNEL);
> +	if (!tmp) {
>  		retval = -ENOMEM;
> -		goto out;
> +		goto error_kfree_fw;
> +	}
> +	tmp->name = kstrdup(name, GFP_KERNEL);
> +	if (!tmp->name) {
> +		retval = -ENOMEM;
> +		goto error_kfree_fw_list;
>  	}

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 0ba8857..c886113 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -428,12 +428,12 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
 	if (!firmware)
 		return -ENOMEM;
 
-	mutex_lock(&fw_lock);
 	tmp = kzalloc(sizeof(struct firmware_list), GFP_KERNEL);
 	if (!tmp) {
 		retval = -ENOMEM;
 		goto error_kfree_fw;
 	}
+	mutex_lock(&fw_lock);
 	tmp->name = kstrdup(name, GFP_KERNEL);
 	if (!tmp->name) {
 		retval = -ENOMEM;




  reply	other threads:[~2008-08-06  9:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-01  6:00 Jaswinder Singh
2008-08-01 20:04 ` David Woodhouse
2008-08-05 21:03 ` Andrew Morton
2008-08-06  9:35   ` Jaswinder Singh
2008-08-06  9:46     ` Jaswinder Singh [this message]
2008-08-06 10:16     ` Jaswinder Singh

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=1218015983.3044.10.camel@jaswinder.satnam \
    --to=jaswinder@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®