[PATCH] pcmcia/vrc4171: Use common error handling code in vrc4171_card_init()

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

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 30 Oct 2017 14:05:35 +0100

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
 drivers/pcmcia/vrc4171_card.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c
index 1e5fa211fb70..56d39585ac9a 100644
--- a/drivers/pcmcia/vrc4171_card.c
+++ b/drivers/pcmcia/vrc4171_card.c
@@ -721,10 +721,8 @@ static int vrc4171_card_init(void)
 		return retval;
 
 	retval = platform_device_register(&vrc4171_card_device);
-	if (retval < 0) {
-		platform_driver_unregister(&vrc4171_card_driver);
-		return retval;
-	}
+	if (retval < 0)
+		goto unregister_driver;
 
 	vrc4171_set_multifunction_pin(vrc4171_slotb);
 
@@ -736,14 +734,17 @@ static int vrc4171_card_init(void)
 	if (retval < 0) {
 		vrc4171_remove_sockets();
 		platform_device_unregister(&vrc4171_card_device);
-		platform_driver_unregister(&vrc4171_card_driver);
-		return retval;
+		goto unregister_driver;
 	}
 
 	printk(KERN_INFO "%s, connected to IRQ %d\n",
 		vrc4171_card_driver.driver.name, vrc4171_irq);
 
 	return 0;
+
+unregister_driver:
+	platform_driver_unregister(&vrc4171_card_driver);
+	return retval;
 }
 
 static void vrc4171_card_exit(void)
-- 
2.14.3

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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