diff options
author | Anton Protopopov | 2014-07-09 07:12:37 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2014-07-09 21:19:36 +0200 |
commit | a5bde3a163cc4701e693c7c1d9cb9d6c9b888c75 (patch) | |
tree | 5fa08c5592615c7de266936d1d22660f523c3de7 /drivers/staging/comedi/comedi_fops.c | |
parent | staging: ft1000-usb: check for errors in card_send_command (diff) | |
download | kernel-qcow2-linux-a5bde3a163cc4701e693c7c1d9cb9d6c9b888c75.tar.gz kernel-qcow2-linux-a5bde3a163cc4701e693c7c1d9cb9d6c9b888c75.tar.xz kernel-qcow2-linux-a5bde3a163cc4701e693c7c1d9cb9d6c9b888c75.zip |
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>
Diffstat (limited to 'drivers/staging/comedi/comedi_fops.c')
-rw-r--r-- | drivers/staging/comedi/comedi_fops.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index e8e38098dcf8..038b69a93185 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -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); |