* hgafb: resource management fix
@ 2008-06-07 22:06 Krzysztof Helt
2008-06-09 0:31 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Helt @ 2008-06-07 22:06 UTC (permalink / raw)
To: Linux-fbdev-devel; +Cc: Andrew Morton
From: Krzysztof Helt <krzysztof.h1@wp.pl>
Release ports which are requested during detection
which are not freed if there is no hga card.
Otherwise there is a crash during cat /proc/ioports command.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
--- linux-rc2/drivers/video/hgafb.c 2008-06-02 20:09:20.139779110 +0200
+++ linux-new/drivers/video/hgafb.c 2008-06-02 20:01:45.030230800 +0200
@@ -279,7 +279,7 @@ static void hga_blank(int blank_mode)
static int __init hga_card_detect(void)
{
- int count=0;
+ int count = 0;
void __iomem *p, *q;
unsigned short p_save, q_save;
@@ -303,20 +303,18 @@ static int __init hga_card_detect(void)
writew(0x55aa, p); if (readw(p) == 0x55aa) count++;
writew(p_save, p);
- if (count != 2) {
- return 0;
- }
+ if (count != 2)
+ goto error;
/* Ok, there is definitely a card registering at the correct
* memory location, so now we do an I/O port test.
*/
- if (!test_hga_b(0x66, 0x0f)) { /* cursor low register */
- return 0;
- }
- if (!test_hga_b(0x99, 0x0f)) { /* cursor low register */
- return 0;
- }
+ if (!test_hga_b(0x66, 0x0f)) /* cursor low register */
+ goto error;
+
+ if (!test_hga_b(0x99, 0x0f)) /* cursor low register */
+ goto error;
/* See if the card is a Hercules, by checking whether the vsync
* bit of the status register is changing. This test lasts for
@@ -331,7 +329,7 @@ static int __init hga_card_detect(void)
}
if (p_save == q_save)
- return 0;
+ goto error;
switch (inb_p(HGA_STATUS_PORT) & 0x70) {
case 0x10:
@@ -348,6 +346,12 @@ static int __init hga_card_detect(void)
break;
}
return 1;
+error:
+ if (release_io_ports)
+ release_region(0x3b0, 12);
+ if (release_io_port)
+ release_region(0x3bf, 1);
+ return 0;
}
/**
---------------------------------------------------------------
Sprawdz jak zdobyc zdrowy usmiech!
Kliknij >> http://link.interia.pl/f1e26
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: hgafb: resource management fix
2008-06-07 22:06 hgafb: resource management fix Krzysztof Helt
@ 2008-06-09 0:31 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2008-06-09 0:31 UTC (permalink / raw)
To: Krzysztof Helt; +Cc: Linux-fbdev-devel
On Sun, 8 Jun 2008 00:06:12 +0200 Krzysztof Helt <krzysztof.h1@poczta.fm> wrote:
> Release ports which are requested during detection
> which are not freed if there is no hga card.
> Otherwise there is a crash during cat /proc/ioports command.
erk.
I'll assume that this is needed in both 2.6.26 and 2.6.25.x.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-09 0:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-07 22:06 hgafb: resource management fix Krzysztof Helt
2008-06-09 0:31 ` Andrew Morton
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).