aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/ds.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r--drivers/pcmcia/ds.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 398146e3823e..080608c7381a 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -354,6 +354,7 @@ static void pcmcia_release_dev(struct device *dev)
354 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 354 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
355 ds_dbg(1, "releasing dev %p\n", p_dev); 355 ds_dbg(1, "releasing dev %p\n", p_dev);
356 pcmcia_put_socket(p_dev->socket); 356 pcmcia_put_socket(p_dev->socket);
357 kfree(p_dev->devname);
357 kfree(p_dev); 358 kfree(p_dev);
358} 359}
359 360
@@ -504,6 +505,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
504{ 505{
505 struct pcmcia_device *p_dev; 506 struct pcmcia_device *p_dev;
506 unsigned long flags; 507 unsigned long flags;
508 int bus_id_len;
507 509
508 s = pcmcia_get_socket(s); 510 s = pcmcia_get_socket(s);
509 if (!s) 511 if (!s)
@@ -527,7 +529,12 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
527 p_dev->dev.bus = &pcmcia_bus_type; 529 p_dev->dev.bus = &pcmcia_bus_type;
528 p_dev->dev.parent = s->dev.dev; 530 p_dev->dev.parent = s->dev.dev;
529 p_dev->dev.release = pcmcia_release_dev; 531 p_dev->dev.release = pcmcia_release_dev;
530 sprintf (p_dev->dev.bus_id, "%d.%d", p_dev->socket->sock, p_dev->device_no); 532 bus_id_len = sprintf (p_dev->dev.bus_id, "%d.%d", p_dev->socket->sock, p_dev->device_no);
533
534 p_dev->devname = kmalloc(6 + bus_id_len + 1, GFP_KERNEL);
535 if (!p_dev->devname)
536 goto err_free;
537 sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id);
531 538
532 /* compat */ 539 /* compat */
533 p_dev->state = CLIENT_UNBOUND; 540 p_dev->state = CLIENT_UNBOUND;
@@ -552,6 +559,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
552 return p_dev; 559 return p_dev;
553 560
554 err_free: 561 err_free:
562 kfree(p_dev->devname);
555 kfree(p_dev); 563 kfree(p_dev);
556 s->device_count--; 564 s->device_count--;
557 err_put: 565 err_put: