linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Len Brown <lenb@kernel.org>, Lan Tianyu <tianyu.lan@intel.com>
Cc: linux-acpi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] ACPI: free memory on an error path
Date: Tue, 25 Sep 2012 10:01:03 +0300	[thread overview]
Message-ID: <20120925070103.GA23009@elgon.mountain> (raw)

We should free "physical_node" if before returning the error code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Only needed in linux-next.  Introduced in 1033f9041d5 "ACPI: Allow ACPI
binding with USB-3.0 hub".

diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index d1a2d74..cfeecac 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -159,7 +159,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
 	if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) {
 		retval = -ENOSPC;
 		mutex_unlock(&acpi_dev->physical_node_lock);
-		goto err;
+		goto free_node;
 	}
 
 	set_bit(physical_node->node_id, acpi_dev->physical_node_id_bitmap);
@@ -185,6 +185,8 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
 
 	return 0;
 
+free_node:
+	kfree(physical_node);
  err:
 	put_device(dev);
 	return retval;

                 reply	other threads:[~2012-09-25  7:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20120925070103.GA23009@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=tianyu.lan@intel.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;
as well as URLs for NNTP newsgroup(s).