Skip to content

Commit

Permalink
pcmcia: avoid late calls to pccard_validate_cis
Browse files Browse the repository at this point in the history
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: Dominik Brodowski <linux@dominikbrodowski.net>
  • Loading branch information
Dominik Brodowski committed Apr 17, 2010
1 parent 41b97ab commit a8408c1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/pcmcia/cistpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,11 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
if (!s)
return -EINVAL;

if (s->functions) {
WARN_ON(1);
return -EINVAL;
}

/* We do not want to validate the CIS cache... */
mutex_lock(&s->ops_mutex);
destroy_cis_cache(s);
Expand Down Expand Up @@ -1639,7 +1644,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj,
count = 0;
else {
struct pcmcia_socket *s;
unsigned int chains;
unsigned int chains = 1;

if (off + count > size)
count = size - off;
Expand All @@ -1648,7 +1653,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj,

if (!(s->state & SOCKET_PRESENT))
return -ENODEV;
if (pccard_validate_cis(s, &chains))
if (!s->functions && pccard_validate_cis(s, &chains))
return -EIO;
if (!chains)
return -ENODATA;
Expand Down

0 comments on commit a8408c1

Please sign in to comment.