From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: Venkatesh Pallipadi <venki@google.com>,
Vojtech Pavlik <vojtech@suse.cz>,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: [PATCH v2 3/4] hpet: clean up io mapping when hpet_alloc() fails
Date: Thu, 18 Mar 2010 11:59:40 -0600 [thread overview]
Message-ID: <20100318175940.15143.53027.stgit@bob.kio> (raw)
In-Reply-To: <20100318175852.15143.2124.stgit@bob.kio>
When hpet_alloc() fails, we should iounmap() the timer so we don't leak
the mapping.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
drivers/char/hpet.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index d132fef..8961985 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -904,7 +904,7 @@ static int hpet_pnp_add(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
{
struct hpet_data data;
struct resource *mem, *irq;
- int i;
+ int i, ret;
memset(&data, 0, sizeof(data));
@@ -924,7 +924,11 @@ static int hpet_pnp_add(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
data.hd_phys_address = mem->start;
data.hd_address = ioremap(mem->start, resource_size(mem));
- return hpet_alloc(&data);
+ ret = hpet_alloc(&data);
+ if (ret)
+ iounmap(data.hd_address);
+
+ return ret;
}
static void hpet_pnp_remove(struct pnp_dev *dev)
next prev parent reply other threads:[~2010-03-18 17:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-18 17:59 [PATCH v2 0/4] hpet: convert from ACPI to PNP driver Bjorn Helgaas
2010-03-18 17:59 ` [PATCH v2 1/4] " Bjorn Helgaas
2010-03-18 19:26 ` Venkatesh Pallipadi
2010-03-18 17:59 ` [PATCH v2 2/4] hpet: pass physical address, not entire hpet_data, to hpet_is_known() Bjorn Helgaas
2010-03-18 19:25 ` Venkatesh Pallipadi
2010-03-18 17:59 ` Bjorn Helgaas [this message]
2010-03-18 19:25 ` [PATCH v2 3/4] hpet: clean up io mapping when hpet_alloc() fails Venkatesh Pallipadi
2010-03-18 17:59 ` [PATCH v2 4/4] MAINTAINERS: remove obsolete HPET ACPI entry Bjorn Helgaas
2010-03-19 8:28 ` [PATCH v2 0/4] hpet: convert from ACPI to PNP driver Clemens Ladisch
2010-03-19 15:58 ` Bjorn Helgaas
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=20100318175940.15143.53027.stgit@bob.kio \
--to=bjorn.helgaas@hp.com \
--cc=clemens@ladisch.de \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=venki@google.com \
--cc=vojtech@suse.cz \
/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
Powered by JetHome