Skip to content

Commit f7d1d23

Browse files
paulusmackLinus Torvalds
authored andcommitted
[PATCH] Obvious bugfix for yenta resource allocation
Recent changes (well, dating from 12 July) have broken cardbus on my powerbook: I get 3 messages saying "no resource of type xxx available, trying to continue", and if I plug in my wireless card, it complains that there are no resources allocated to the card. This all worked in 2.6.12. Looking at the code in yenta_socket.c, function yenta_allocate_res, it's obvious what is wrong: if we get to line 639 (i.e. there wasn't a usable preassigned resource), we will always flow through to line 668, which is the printk that I was seeing, even if a resource was successfully allocated. It looks to me as though there should be a return statement after the two config_writel's in each of the 3 branches of the if statements, so that the function returns after successfully setting up the resource. The patch below adds these return statements, and with this patch, cardbus works on my powerbook once again. Signed-off-by: Paul Mackerras <paulus@samba.org> Acked-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 9a351e3 commit f7d1d23

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/pcmcia/yenta_socket.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
642642
(yenta_search_res(socket, res, BRIDGE_IO_MIN))) {
643643
config_writel(socket, addr_start, res->start);
644644
config_writel(socket, addr_end, res->end);
645+
return;
645646
}
646647
} else {
647648
if (type & IORESOURCE_PREFETCH) {
@@ -650,6 +651,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
650651
(yenta_search_res(socket, res, BRIDGE_MEM_MIN))) {
651652
config_writel(socket, addr_start, res->start);
652653
config_writel(socket, addr_end, res->end);
654+
return;
653655
}
654656
/* Approximating prefetchable by non-prefetchable */
655657
res->flags = IORESOURCE_MEM;
@@ -659,6 +661,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
659661
(yenta_search_res(socket, res, BRIDGE_MEM_MIN))) {
660662
config_writel(socket, addr_start, res->start);
661663
config_writel(socket, addr_end, res->end);
664+
return;
662665
}
663666
}
664667

0 commit comments

Comments
 (0)