diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2010-08-09 20:20:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-09 23:45:06 -0400 |
commit | b329becfc78b180d5c422c9cb24a6ab378603305 (patch) | |
tree | e0a977fef2f05b0863c99738eb170ba852c97e1f | |
parent | 878ae1274944908e1863b06b03a2c94907afaa20 (diff) |
char: add WARN_ON() in misc_deregister()
misc_deregister() returns an error only when it attempts to unregister
the device that is not registered. This is the driver's bug.
Most of the drivers don't check the return value of misc_deregister().
(It is not bad thing because most of kernel *_unregister() API always
succeed and do not return value)
So it is better to indicate the error by WARN_ON() in misc_deregister().
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/char/misc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index cd650ca8c679..abdafd488980 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -242,7 +242,7 @@ int misc_deregister(struct miscdevice *misc) | |||
242 | { | 242 | { |
243 | int i = DYNAMIC_MINORS - misc->minor - 1; | 243 | int i = DYNAMIC_MINORS - misc->minor - 1; |
244 | 244 | ||
245 | if (list_empty(&misc->list)) | 245 | if (WARN_ON(list_empty(&misc->list))) |
246 | return -EINVAL; | 246 | return -EINVAL; |
247 | 247 | ||
248 | mutex_lock(&misc_mtx); | 248 | mutex_lock(&misc_mtx); |