From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Alessandro Zummo <a.zummo@towertech.it>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Subject: [patch 1/2] rtc: release correct region in error path
Date: Tue, 23 Oct 2007 14:48:44 -0600 [thread overview]
Message-ID: <20071023205515.406778977@ldl.fc.hp.com> (raw)
In-Reply-To: 20071023204843.442608289@ldl.fc.hp.com
[-- Attachment #1: rtc-factor --]
[-- Type: text/plain, Size: 1542 bytes --]
The misc_register() error path always released an I/O port region,
even if the region was memory-mapped (only mips uses memory-mapped RTC,
as far as I can see).
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: w/drivers/char/rtc.c
===================================================================
--- w.orig/drivers/char/rtc.c 2007-10-23 09:59:33.000000000 -0600
+++ w/drivers/char/rtc.c 2007-10-23 14:41:23.000000000 -0600
@@ -918,6 +918,14 @@
};
#endif
+static void rtc_release_region(void)
+{
+ if (RTC_IOMAPPED)
+ release_region(RTC_PORT(0), RTC_IO_EXTENT);
+ else
+ release_mem_region(RTC_PORT(0), RTC_IO_EXTENT);
+}
+
static int __init rtc_init(void)
{
#ifdef CONFIG_PROC_FS
@@ -992,10 +1000,7 @@
/* Yeah right, seeing as irq 8 doesn't even hit the bus. */
rtc_has_irq = 0;
printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ);
- if (RTC_IOMAPPED)
- release_region(RTC_PORT(0), RTC_IO_EXTENT);
- else
- release_mem_region(RTC_PORT(0), RTC_IO_EXTENT);
+ rtc_release_region();
return -EIO;
}
hpet_rtc_timer_init();
@@ -1009,7 +1014,7 @@
free_irq(RTC_IRQ, NULL);
rtc_has_irq = 0;
#endif
- release_region(RTC_PORT(0), RTC_IO_EXTENT);
+ rtc_release_region();
return -ENODEV;
}
@@ -1091,10 +1096,7 @@
if (rtc_has_irq)
free_irq (rtc_irq, &rtc_port);
#else
- if (RTC_IOMAPPED)
- release_region(RTC_PORT(0), RTC_IO_EXTENT);
- else
- release_mem_region(RTC_PORT(0), RTC_IO_EXTENT);
+ rtc_release_region();
#ifdef RTC_IRQ
if (rtc_has_irq)
free_irq (RTC_IRQ, NULL);
--
next prev parent reply other threads:[~2007-10-23 20:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-23 20:48 [patch 0/2] RTC fixes Bjorn Helgaas
2007-10-23 20:48 ` Bjorn Helgaas [this message]
2007-10-24 15:12 ` [patch 1/2] rtc: release correct region in error path Ralf Baechle
2007-10-23 20:48 ` [patch 2/2] rtc: fallback to requesting only the ports we actually use 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=20071023205515.406778977@ldl.fc.hp.com \
--to=bjorn.helgaas@hp.com \
--cc=a.zummo@towertech.it \
--cc=akpm@linux-foundation.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