From: Akinobu Mita Date: Tue, 10 Aug 2010 00:20:35 +0000 (-0700) Subject: char: add WARN_ON() in misc_deregister() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b329becfc78b180d5c422c9cb24a6ab378603305;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Cc: Heiko Carstens Cc: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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) { int i = DYNAMIC_MINORS - misc->minor - 1; - if (list_empty(&misc->list)) + if (WARN_ON(list_empty(&misc->list))) return -EINVAL; mutex_lock(&misc_mtx);