HID: hidraw: improve error handling in hidraw_init()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Wed, 15 Aug 2012 19:31:45 +0000 (23:31 +0400)
committerJiri Kosina <jkosina@suse.cz>
Wed, 15 Aug 2012 19:37:09 +0000 (21:37 +0200)
Several improvements in error handling:
- do not report success if alloc_chrdev_region() failed
- check for error code of cdev_add()
- use unregister_chrdev_region() instead of unregister_chrdev()
  if class_create() failed

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hidraw.c

Simple merge