Commit 5a26baff authored by Russell King's avatar Russell King

[PCMCIA] Don't add CIS cache entries on failure.

If we fail to map the CIS space, don't pollute the CIS cache with
invalid data.
parent 8bb27707
...@@ -293,15 +293,17 @@ static void read_cis_cache(struct pcmcia_socket *s, int attr, u_int addr, ...@@ -293,15 +293,17 @@ static void read_cis_cache(struct pcmcia_socket *s, int attr, u_int addr,
#endif #endif
ret = read_cis_mem(s, attr, addr, len, ptr); ret = read_cis_mem(s, attr, addr, len, ptr);
/* Copy data into the cache */ if (ret == 0) {
cis = kmalloc(sizeof(struct cis_cache_entry) + len, GFP_KERNEL); /* Copy data into the cache */
if (cis) { cis = kmalloc(sizeof(struct cis_cache_entry) + len, GFP_KERNEL);
cis->addr = addr; if (cis) {
cis->len = len; cis->addr = addr;
cis->attr = attr; cis->len = len;
memcpy(cis->cache, ptr, len); cis->attr = attr;
list_add(&cis->node, &s->cis_cache); memcpy(cis->cache, ptr, len);
} list_add(&cis->node, &s->cis_cache);
}
}
} }
static void static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment