Commit a8408c17 authored by Dominik Brodowski's avatar Dominik Brodowski

pcmcia: avoid late calls to pccard_validate_cis

pccard_validate_cis() nowadays destroys the CIS cache. Therefore,
calling it after card setup should be avoided. We can't control
the deprecated PCMCIA ioctl (which is only used on ARM nowadays),
but we can avoid -- and report -- any other calls.
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent 41b97ab5
...@@ -1484,6 +1484,11 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info) ...@@ -1484,6 +1484,11 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
if (!s) if (!s)
return -EINVAL; return -EINVAL;
if (s->functions) {
WARN_ON(1);
return -EINVAL;
}
/* We do not want to validate the CIS cache... */ /* We do not want to validate the CIS cache... */
mutex_lock(&s->ops_mutex); mutex_lock(&s->ops_mutex);
destroy_cis_cache(s); destroy_cis_cache(s);
...@@ -1639,7 +1644,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj, ...@@ -1639,7 +1644,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj,
count = 0; count = 0;
else { else {
struct pcmcia_socket *s; struct pcmcia_socket *s;
unsigned int chains; unsigned int chains = 1;
if (off + count > size) if (off + count > size)
count = size - off; count = size - off;
...@@ -1648,7 +1653,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj, ...@@ -1648,7 +1653,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj,
if (!(s->state & SOCKET_PRESENT)) if (!(s->state & SOCKET_PRESENT))
return -ENODEV; return -ENODEV;
if (pccard_validate_cis(s, &chains)) if (!s->functions && pccard_validate_cis(s, &chains))
return -EIO; return -EIO;
if (!chains) if (!chains)
return -ENODATA; return -ENODATA;
......
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