Staging: comedi: check the return value of kobject_set_name

Added a check of the return value of the kobject_set_name function.

Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Anton Protopopov 2014-07-09 09:12:37 +04:00 committed by Greg Kroah-Hartman
parent eedd8d7ee8
commit a5bde3a163

View File

@ -2587,7 +2587,14 @@ static int __init comedi_init(void)
return -EIO;
cdev_init(&comedi_cdev, &comedi_fops);
comedi_cdev.owner = THIS_MODULE;
kobject_set_name(&comedi_cdev.kobj, "comedi");
retval = kobject_set_name(&comedi_cdev.kobj, "comedi");
if (retval) {
unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
COMEDI_NUM_MINORS);
return retval;
}
if (cdev_add(&comedi_cdev, MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS)) {
unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
COMEDI_NUM_MINORS);