|
Takashi Iwai |
3e5a50 |
From 44fd1917314e9d4f53dd95dd65df1c152f503d3a Mon Sep 17 00:00:00 2001
|
|
Takashi Iwai |
3e5a50 |
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
|
|
Takashi Iwai |
3e5a50 |
Date: Wed, 15 Jun 2022 07:33:44 +0200
|
|
Takashi Iwai |
3e5a50 |
Subject: [PATCH] misc: rtsx: Fix an error handling path in rtsx_pci_probe()
|
|
Takashi Iwai |
3e5a50 |
Git-commit: 44fd1917314e9d4f53dd95dd65df1c152f503d3a
|
|
Takashi Iwai |
3e5a50 |
Patch-mainline: v6.0-rc1
|
|
Takashi Iwai |
3e5a50 |
References: git-fixes
|
|
Takashi Iwai |
3e5a50 |
|
|
Takashi Iwai |
3e5a50 |
If an error occurs after a successful idr_alloc() call, the corresponding
|
|
Takashi Iwai |
3e5a50 |
resource must be released with idr_remove() as already done in the .remove
|
|
Takashi Iwai |
3e5a50 |
function.
|
|
Takashi Iwai |
3e5a50 |
|
|
Takashi Iwai |
3e5a50 |
Update the error handling path to add the missing idr_remove() call.
|
|
Takashi Iwai |
3e5a50 |
|
|
Takashi Iwai |
3e5a50 |
Fixes: ada8a8a13b13 ("mfd: Add realtek pcie card reader driver")
|
|
Takashi Iwai |
3e5a50 |
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
|
|
Takashi Iwai |
3e5a50 |
Link: https://lore.kernel.org/r/e8dc41716cbf52fb37a12e70d8972848e69df6d6.1655271216.git.christophe.jaillet@wanadoo.fr
|
|
Takashi Iwai |
3e5a50 |
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
Takashi Iwai |
3e5a50 |
Acked-by: Takashi Iwai <tiwai@suse.de>
|
|
Takashi Iwai |
3e5a50 |
|
|
Takashi Iwai |
3e5a50 |
---
|
|
Takashi Iwai |
3e5a50 |
drivers/misc/cardreader/rtsx_pcr.c | 6 +++++-
|
|
Takashi Iwai |
3e5a50 |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
Takashi Iwai |
3e5a50 |
|
|
Takashi Iwai |
3e5a50 |
--- a/drivers/misc/cardreader/rtsx_pcr.c
|
|
Takashi Iwai |
3e5a50 |
+++ b/drivers/misc/cardreader/rtsx_pcr.c
|
|
Takashi Iwai |
3e5a50 |
@@ -1485,7 +1485,7 @@ static int rtsx_pci_probe(struct pci_dev
|
|
Takashi Iwai |
3e5a50 |
pcr->remap_addr = ioremap_nocache(base, len);
|
|
Takashi Iwai |
3e5a50 |
if (!pcr->remap_addr) {
|
|
Takashi Iwai |
3e5a50 |
ret = -ENOMEM;
|
|
Takashi Iwai |
3e5a50 |
- goto free_handle;
|
|
Takashi Iwai |
3e5a50 |
+ goto free_idr;
|
|
Takashi Iwai |
3e5a50 |
}
|
|
Takashi Iwai |
3e5a50 |
|
|
Takashi Iwai |
3e5a50 |
pcr->rtsx_resv_buf = dma_alloc_coherent(&(pcidev->dev),
|
|
Takashi Iwai |
3e5a50 |
@@ -1547,6 +1547,10 @@ disable_msi:
|
|
Takashi Iwai |
3e5a50 |
pcr->rtsx_resv_buf, pcr->rtsx_resv_buf_addr);
|
|
Takashi Iwai |
3e5a50 |
unmap:
|
|
Takashi Iwai |
3e5a50 |
iounmap(pcr->remap_addr);
|
|
Takashi Iwai |
3e5a50 |
+free_idr:
|
|
Takashi Iwai |
3e5a50 |
+ spin_lock(&rtsx_pci_lock);
|
|
Takashi Iwai |
3e5a50 |
+ idr_remove(&rtsx_pci_idr, pcr->id);
|
|
Takashi Iwai |
3e5a50 |
+ spin_unlock(&rtsx_pci_lock);
|
|
Takashi Iwai |
3e5a50 |
free_handle:
|
|
Takashi Iwai |
3e5a50 |
kfree(handle);
|
|
Takashi Iwai |
3e5a50 |
free_pcr:
|