Commit 1d9e3a07 authored by Christian Gromm's avatar Christian Gromm Committed by Greg Kroah-Hartman

staging: most: aim-cdev: destroy ida struct in case of exception

This patch is needed to clean up the initialized ida structure in case
the function exits with an exception.
Signed-off-by: default avatarChristian Gromm <christian.gromm@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 88b090e3
...@@ -509,7 +509,7 @@ static int __init mod_init(void) ...@@ -509,7 +509,7 @@ static int __init mod_init(void)
err = alloc_chrdev_region(&aim_devno, 0, 50, "cdev"); err = alloc_chrdev_region(&aim_devno, 0, 50, "cdev");
if (err < 0) if (err < 0)
return err; goto dest_ida;
major = MAJOR(aim_devno); major = MAJOR(aim_devno);
aim_class = class_create(THIS_MODULE, "most_cdev_aim"); aim_class = class_create(THIS_MODULE, "most_cdev_aim");
...@@ -527,6 +527,8 @@ static int __init mod_init(void) ...@@ -527,6 +527,8 @@ static int __init mod_init(void)
class_destroy(aim_class); class_destroy(aim_class);
free_cdev: free_cdev:
unregister_chrdev_region(aim_devno, 1); unregister_chrdev_region(aim_devno, 1);
dest_ida:
ida_destroy(&minor_id);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment