diff options
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/socket_sysfs.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index c5d7476da471..933cd864a5c9 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -298,7 +298,7 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz | |||
298 | { | 298 | { |
299 | struct pcmcia_socket *s = to_socket(container_of(kobj, struct class_device, kobj)); | 299 | struct pcmcia_socket *s = to_socket(container_of(kobj, struct class_device, kobj)); |
300 | cisdump_t *cis; | 300 | cisdump_t *cis; |
301 | ssize_t ret = count; | 301 | int error; |
302 | 302 | ||
303 | if (off) | 303 | if (off) |
304 | return -EINVAL; | 304 | return -EINVAL; |
@@ -316,25 +316,22 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz | |||
316 | cis->Length = count + 1; | 316 | cis->Length = count + 1; |
317 | memcpy(cis->Data, buf, count); | 317 | memcpy(cis->Data, buf, count); |
318 | 318 | ||
319 | if (pcmcia_replace_cis(s, cis)) | 319 | error = pcmcia_replace_cis(s, cis); |
320 | ret = -EIO; | ||
321 | |||
322 | kfree(cis); | 320 | kfree(cis); |
321 | if (error) | ||
322 | return -EIO; | ||
323 | 323 | ||
324 | if (!ret) { | 324 | mutex_lock(&s->skt_mutex); |
325 | mutex_lock(&s->skt_mutex); | 325 | if ((s->callback) && (s->state & SOCKET_PRESENT) && |
326 | if ((s->callback) && (s->state & SOCKET_PRESENT) && | 326 | !(s->state & SOCKET_CARDBUS)) { |
327 | !(s->state & SOCKET_CARDBUS)) { | 327 | if (try_module_get(s->callback->owner)) { |
328 | if (try_module_get(s->callback->owner)) { | 328 | s->callback->requery(s); |
329 | s->callback->requery(s); | 329 | module_put(s->callback->owner); |
330 | module_put(s->callback->owner); | ||
331 | } | ||
332 | } | 330 | } |
333 | mutex_unlock(&s->skt_mutex); | ||
334 | } | 331 | } |
332 | mutex_unlock(&s->skt_mutex); | ||
335 | 333 | ||
336 | 334 | return count; | |
337 | return (ret); | ||
338 | } | 335 | } |
339 | 336 | ||
340 | 337 | ||