Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Christian Gromm and committed by
Greg Kroah-Hartman
1d9e3a07 88b090e3

+3 -1
+3 -1
drivers/staging/most/aim-cdev/cdev.c
··· 509 509 510 510 err = alloc_chrdev_region(&aim_devno, 0, 50, "cdev"); 511 511 if (err < 0) 512 - return err; 512 + goto dest_ida; 513 513 major = MAJOR(aim_devno); 514 514 515 515 aim_class = class_create(THIS_MODULE, "most_cdev_aim"); ··· 527 527 class_destroy(aim_class); 528 528 free_cdev: 529 529 unregister_chrdev_region(aim_devno, 1); 530 + dest_ida: 531 + ida_destroy(&minor_id); 530 532 return err; 531 533 } 532 534