[PATCH] mmc: cb710: Fix an error handling path in cb710_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If an error occurs after a successful ida_alloc() call, it should be undone
by a corresponding ida_free(), as already done in the remove function.

Add the missing call in the error handling path of cb710_probe().

Fixes: 5f5bac8272be ("mmc: Driver for CB710/720 memory card reader (MMC part)")
Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
 drivers/misc/cb710/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c
index 55b7ee0e8f93..394fc2488029 100644
--- a/drivers/misc/cb710/core.c
+++ b/drivers/misc/cb710/core.c
@@ -250,7 +250,7 @@ static int cb710_probe(struct pci_dev *pdev,
 		err = cb710_register_slot(chip,
 			CB710_SLOT_MMC, 0x00, "cb710-mmc");
 		if (err)
-			return err;
+			goto free_platform_id;
 	}
 
 	if (val & CB710_SLOT_MS) {	/* MemoryStick slot */
@@ -276,6 +276,10 @@ static int cb710_probe(struct pci_dev *pdev,
 #ifdef CONFIG_CB710_DEBUG_ASSUMPTIONS
 	BUG_ON(atomic_read(&chip->slot_refs_count) != 0);
 #endif
+
+free_platform_id:
+	ida_free(&cb710_ida, chip->platform_id);
+
 	return err;
 }
 
-- 
2.48.1





[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux