public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] char: add WARN_ON() in misc_deregister()
@ 2010-05-29  4:28 Akinobu Mita
  2010-05-29  4:28 ` [PATCH 2/2] s390: remove WARN_ON for misc_deregister() failures Akinobu Mita
  0 siblings, 1 reply; 2+ messages in thread
From: Akinobu Mita @ 2010-05-29  4:28 UTC (permalink / raw)
  To: linux-kernel, akpm, linux390, linux-s390; +Cc: Akinobu Mita

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>
---
 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 cd650ca..abdafd4 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);
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-29  4:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-29  4:28 [PATCH 1/2] char: add WARN_ON() in misc_deregister() Akinobu Mita
2010-05-29  4:28 ` [PATCH 2/2] s390: remove WARN_ON for misc_deregister() failures Akinobu Mita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox