Module: xenomai-jki
Branch: queues/proc
Commit: 785c61b4bde27c36ef0d7d013bc6b81442b0ecd4
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=785c61b4bde27c36ef0d7d013bc6b81442b0ecd4

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Tue Apr  6 17:30:33 2010 +0200

RTDM: Properly clean up on proc setup errors

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 ksrc/skins/rtdm/proc.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/ksrc/skins/rtdm/proc.c b/ksrc/skins/rtdm/proc.c
index b889f73..70ee4a2 100644
--- a/ksrc/skins/rtdm/proc.c
+++ b/ksrc/skins/rtdm/proc.c
@@ -292,34 +292,38 @@ int __init rtdm_proc_init(void)
        /* Initialise /proc entries */
        rtdm_proc_root = create_proc_entry("xenomai/rtdm", S_IFDIR, NULL);
        if (!rtdm_proc_root)
-               return -EAGAIN;
+               goto error;
 
        proc_entry = create_proc_entry("named_devices", S_IFREG | S_IRUGO,
                                       rtdm_proc_root);
        if (!proc_entry)
-               return -EAGAIN;
+               goto error;
        proc_entry->read_proc = proc_read_named_devs;
 
        proc_entry = create_proc_entry("protocol_devices", S_IFREG | S_IRUGO,
                                       rtdm_proc_root);
        if (!proc_entry)
-               return -EAGAIN;
+               goto error;
        proc_entry->read_proc = proc_read_proto_devs;
 
        proc_entry =
            create_proc_entry("open_fildes", S_IFREG | S_IRUGO, rtdm_proc_root);
        if (!proc_entry)
-               return -EAGAIN;
+               goto error;
        proc_entry->read_proc = proc_read_open_fildes;
        proc_entry->write_proc = proc_kill_open_fildes;
 
        proc_entry =
            create_proc_entry("fildes", S_IFREG | S_IRUGO, rtdm_proc_root);
        if (!proc_entry)
-               return -EAGAIN;
+               goto error;
        proc_entry->read_proc = proc_read_fildes;
 
        return 0;
+
+error:
+       rtdm_proc_cleanup();
+       return -EAGAIN;
 }
 
 void rtdm_proc_cleanup(void)


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to