Subject: [PATCH] sky2: check pci_register_driver() error

From: Akinobu Mita <[email-masked]>
Date: Sat, 15 Dec 2007 20:58:51 +0900

Check pci_register_driver() error and clean up debugfs entries
if error happened.

Cc: Stephen Hemminger <[email-masked]>
Signed-off-by: Akinobu Mita <[email-masked]>

---
 drivers/net/sky2.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: 2.6-git/drivers/net/sky2.c
===================================================================
--- 2.6-git.orig/drivers/net/sky2.c
+++ 2.6-git/drivers/net/sky2.c
@@ -4426,8 +4426,15 @@ static struct pci_driver sky2_driver = {
 
 static int __init sky2_init_module(void)
 {
+	int err;
+
 	sky2_debug_init();
-	return pci_register_driver(&sky2_driver);
+	err = pci_register_driver(&sky2_driver);
+	if (err) {
+		sky2_debug_cleanup();
+		return err;
+	}
+	return 0;
 }
 
 static void __exit sky2_cleanup_module(void)