[PATCH] Staging: dgnc: use goto for error handling in dgnc_start()

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

 



The error handling for register_chrdev is taken care by goto statement.
The failure code from register_chrdev is returned.

Signed-off-by: Salah Triki <salah.triki@xxxxxxx>
---
 drivers/staging/dgnc/dgnc_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
index f177d3a..ee27fb2 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -253,7 +253,7 @@ static int dgnc_start(void)
 	rc = register_chrdev(0, "dgnc", &dgnc_BoardFops);
 	if (rc <= 0) {
 		pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc);
-		return -ENXIO;
+		goto failed_register;
 	}
 	dgnc_Major = rc;
 
@@ -302,6 +302,7 @@ failed_device:
 	class_destroy(dgnc_class);
 failed_class:
 	unregister_chrdev(dgnc_Major, "dgnc");
+failed_register:
 	return rc;
 }
 
-- 
1.9.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux