diff options
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/cistpl.c | 9 | ||||
-rw-r--r-- | drivers/pcmcia/rsrc_nonstatic.c | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 8567f4fad501..dd7651ff5b43 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c | |||
@@ -89,6 +89,8 @@ static void __iomem * | |||
89 | set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags) | 89 | set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags) |
90 | { | 90 | { |
91 | pccard_mem_map *mem = &s->cis_mem; | 91 | pccard_mem_map *mem = &s->cis_mem; |
92 | int ret; | ||
93 | |||
92 | if (!(s->features & SS_CAP_STATIC_MAP) && mem->res == NULL) { | 94 | if (!(s->features & SS_CAP_STATIC_MAP) && mem->res == NULL) { |
93 | mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); | 95 | mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); |
94 | if (mem->res == NULL) { | 96 | if (mem->res == NULL) { |
@@ -99,7 +101,12 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag | |||
99 | } | 101 | } |
100 | mem->card_start = card_offset; | 102 | mem->card_start = card_offset; |
101 | mem->flags = flags; | 103 | mem->flags = flags; |
102 | s->ops->set_mem_map(s, mem); | 104 | ret = s->ops->set_mem_map(s, mem); |
105 | if (ret) { | ||
106 | iounmap(s->cis_virt); | ||
107 | return NULL; | ||
108 | } | ||
109 | |||
103 | if (s->features & SS_CAP_STATIC_MAP) { | 110 | if (s->features & SS_CAP_STATIC_MAP) { |
104 | if (s->cis_virt) | 111 | if (s->cis_virt) |
105 | iounmap(s->cis_virt); | 112 | iounmap(s->cis_virt); |
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index c8f21796c592..51aa04b7ecc9 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c | |||
@@ -372,6 +372,9 @@ static int do_mem_probe(u_long base, u_long num, struct pcmcia_socket *s) | |||
372 | base, base+num-1); | 372 | base, base+num-1); |
373 | bad = fail = 0; | 373 | bad = fail = 0; |
374 | step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff); | 374 | step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff); |
375 | /* don't allow too large steps */ | ||
376 | if (step > 0x800000) | ||
377 | step = 0x800000; | ||
375 | /* cis_readable wants to map 2x map_size */ | 378 | /* cis_readable wants to map 2x map_size */ |
376 | if (step < 2 * s->map_size) | 379 | if (step < 2 * s->map_size) |
377 | step = 2 * s->map_size; | 380 | step = 2 * s->map_size; |
@@ -465,8 +468,7 @@ static void validate_mem(struct pcmcia_socket *s, unsigned int probe_mask) | |||
465 | 468 | ||
466 | for (m = s_data->mem_db.next; m != &s_data->mem_db; m = mm.next) { | 469 | for (m = s_data->mem_db.next; m != &s_data->mem_db; m = mm.next) { |
467 | mm = *m; | 470 | mm = *m; |
468 | if (do_mem_probe(mm.base, mm.num, s)) | 471 | do_mem_probe(mm.base, mm.num, s); |
469 | break; | ||
470 | } | 472 | } |
471 | } | 473 | } |
472 | 474 | ||