diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-11-08 03:40:42 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-11-08 03:40:42 +0300 |
commit | d3fbdb8ad33491f7c241a1167d7e3009f6e3f085 (patch) | |
tree | 95adc3aa7aeb69c1e4f98c1be16e2e56781f2c7c /drivers/pcmcia/ds.c | |
parent | dc1434801d2ee8b57286f587877e67d2f9b699d6 (diff) | |
parent | 4f733de8b78a209501041a4b0a44c83ece0e8933 (diff) | |
download | linux-d3fbdb8ad33491f7c241a1167d7e3009f6e3f085.tar.xz |
Merge tag 'pcmcia-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux
Pull PCMCIA updates from Dominik Brodowski:
"Cleanups and fixes.
Yang Yingliang has fixed a number of resource leaks and Dongliang Mu
contributed a spelling fix for the PCMCIA core. Also included is a
tiny clenaup to the tcic PCMCIA socket driver provided by lizhe"
* tag 'pcmcia-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux:
pcmcia: tcic: remove unneeded "&" in call to setup_timer()
pcmcia: typo fix
pcmcia: ds: fix possible name leak in error path in pcmcia_device_add()
pcmcia: ds: fix refcount leak in pcmcia_device_add()
pcmcia: cs: fix possible hung task and memory leak pccardd()
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r-- | drivers/pcmcia/ds.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index d500e5dbbc3f..b4b8363d1de2 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -513,9 +513,6 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, /* by default don't allow DMA */ p_dev->dma_mask = 0; p_dev->dev.dma_mask = &p_dev->dma_mask; - dev_set_name(&p_dev->dev, "%d.%d", p_dev->socket->sock, p_dev->device_no); - if (!dev_name(&p_dev->dev)) - goto err_free; p_dev->devname = kasprintf(GFP_KERNEL, "pcmcia%s", dev_name(&p_dev->dev)); if (!p_dev->devname) goto err_free; @@ -573,8 +570,15 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, pcmcia_device_query(p_dev); - if (device_register(&p_dev->dev)) - goto err_unreg; + dev_set_name(&p_dev->dev, "%d.%d", p_dev->socket->sock, p_dev->device_no); + if (device_register(&p_dev->dev)) { + mutex_lock(&s->ops_mutex); + list_del(&p_dev->socket_device_list); + s->device_count--; + mutex_unlock(&s->ops_mutex); + put_device(&p_dev->dev); + return NULL; + } return p_dev; |