Skip to contentSkip to conversation

drivers/pcmcia/m32r_pcc.c: use common error path

PATCH New [email protected] 1 participant 1 message Dec 13, 2016 Pcmcia

lore
Share & tools
lore
#0 lore raw

PATCH 9/123 drivers/pcmcia/m32r_pcc.c: use common error path

From: Sudip Mukherjee <[email protected]>
Subject: drivers/pcmcia/m32r_pcc.c: use common error path

Use a common error path for the failure.

---

 drivers/pcmcia/m32r_pcc.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/pcmcia/m32r_pcc.c renamed from drivers/pcmcia/m32r_pcc.c~pcmcia-m32r_pcc-use-common-error-path +10 -7
diff -puN drivers/pcmcia/m32r_pcc.c~pcmcia-m32r_pcc-use-common-error-path drivers/pcmcia/m32r_pcc.c
@@ -689,10 +689,8 @@ static int __init init_m32r_pcc(void)
 		return ret;
 
 	ret = platform_device_register(&pcc_device);
-	if (ret){
-		platform_driver_unregister(&pcc_driver);
-		return ret;
-	}
+	if (ret)
+		goto unreg_driv;
 
 	printk(KERN_INFO "m32r PCC probe:\n");
 
@@ -706,9 +704,8 @@ static int __init init_m32r_pcc(void)
 
 	if (pcc_sockets == 0) {
 		printk("socket is not found.\n");
-		platform_device_unregister(&pcc_device);
-		platform_driver_unregister(&pcc_driver);
-		return -ENODEV;
+		ret = -ENODEV;
+		goto unreg_dev;
 	}
 
 	/* Set up interrupt handler(s) */
@@ -734,6 +731,12 @@ static int __init init_m32r_pcc(void)
 	}
 
 	return 0;
+
+unreg_dev:
+	platform_device_unregister(&pcc_device);
+unreg_driv:
+	platform_driver_unregister(&pcc_driver);
+	return ret;
 } /* init_m32r_pcc */
 
 static void __exit exit_m32r_pcc(void)

_