From: Christian Gromm Date: Mon, 22 Aug 2016 14:46:24 +0000 (+0200) Subject: staging: most: aim-cdev: destroy ida struct in case of exception X-Git-Tag: v4.9-rc1~119^2~899 X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=1d9e3a07cb80ca7c8f4efcfcc6c4ca10790d9645;p=cascardo%2Flinux.git 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: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c index db6f4586bcaf..1c20ae69c561 100644 --- a/drivers/staging/most/aim-cdev/cdev.c +++ b/drivers/staging/most/aim-cdev/cdev.c @@ -509,7 +509,7 @@ static int __init mod_init(void) err = alloc_chrdev_region(&aim_devno, 0, 50, "cdev"); if (err < 0) - return err; + goto dest_ida; major = MAJOR(aim_devno); aim_class = class_create(THIS_MODULE, "most_cdev_aim"); @@ -527,6 +527,8 @@ dest_class: class_destroy(aim_class); free_cdev: unregister_chrdev_region(aim_devno, 1); +dest_ida: + ida_destroy(&minor_id); return err; }