Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=809e905ce73eaa13972c2617959f8ec16e7d0d6f
Commit:     809e905ce73eaa13972c2617959f8ec16e7d0d6f
Parent:     fdc0092bfd68cedfb9929256957f64c2c2760b5c
Author:     Akinobu Mita <[EMAIL PROTECTED]>
AuthorDate: Sat Apr 21 18:36:26 2007 +0900
Committer:  Stefan Richter <[EMAIL PROTECTED]>
CommitDate: Mon Apr 30 00:00:32 2007 +0200

    ieee1394: eth1394: fix error path in module_init
    
    This patch fixes some error handlings in eth1394:
    
    - check return value of kmem_cache_create()
    - cleanup resources if hpsb_register_protocol() fails
    
    Signed-off-by: Akinobu Mita <[EMAIL PROTECTED]>
    Signed-off-by: Stefan Richter <[EMAIL PROTECTED]> (whitespace)
---
 drivers/ieee1394/eth1394.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index 1c26322..bd67c86 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -1667,17 +1667,26 @@ static struct ethtool_ops ethtool_ops = {
        .get_drvinfo = ether1394_get_drvinfo
 };
 
-static int __init ether1394_init_module (void)
+static int __init ether1394_init_module(void)
 {
+       int err;
+
        packet_task_cache = kmem_cache_create("packet_task",
                                              sizeof(struct packet_task),
                                              0, 0, NULL, NULL);
+       if (!packet_task_cache)
+               return -ENOMEM;
 
        hpsb_register_highlevel(&eth1394_highlevel);
-       return hpsb_register_protocol(&eth1394_proto_driver);
+       err = hpsb_register_protocol(&eth1394_proto_driver);
+       if (err) {
+               hpsb_unregister_highlevel(&eth1394_highlevel);
+               kmem_cache_destroy(packet_task_cache);
+       }
+       return err;
 }
 
-static void __exit ether1394_exit_module (void)
+static void __exit ether1394_exit_module(void)
 {
        hpsb_unregister_protocol(&eth1394_proto_driver);
        hpsb_unregister_highlevel(&eth1394_highlevel);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to