public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Driver Core fixes for 2.6.0-test3
Date: Fri, 15 Aug 2003 11:25:49 -0700	[thread overview]
Message-ID: <10609719491100@kroah.com> (raw)
In-Reply-To: <10609719492406@kroah.com>

ChangeSet 1.1152.2.7, 2003/08/15 10:12:59-07:00, greg@kroah.com

Driver Core: add warnings if .release functions are not set for objects.

This has been in the -mm tree for a while and has helped a lot in finding
lots of improper users of the driver core.  It also moves the driver core
code up quite a few levels on the "Rusty's guide to kernel APIs".


 drivers/base/class.c |    6 ++++++
 drivers/base/core.c  |    6 ++++++
 2 files changed, 12 insertions(+)


diff -Nru a/drivers/base/class.c b/drivers/base/class.c
--- a/drivers/base/class.c	Fri Aug 15 11:15:48 2003
+++ b/drivers/base/class.c	Fri Aug 15 11:15:48 2003
@@ -194,6 +194,12 @@
 
 	if (cls->release)
 		cls->release(cd);
+	else {
+		printk(KERN_ERR "Device class '%s' does not have a release() function, "
+			"it is broken and must be fixed.\n",
+			cd->class_id);
+		WARN_ON(1);
+	}
 }
 
 static struct kobj_type ktype_class_device = {
diff -Nru a/drivers/base/core.c b/drivers/base/core.c
--- a/drivers/base/core.c	Fri Aug 15 11:15:48 2003
+++ b/drivers/base/core.c	Fri Aug 15 11:15:48 2003
@@ -77,6 +77,12 @@
 	struct device * dev = to_dev(kobj);
 	if (dev->release)
 		dev->release(dev);
+	else {
+		printk(KERN_ERR "Device '%s' does not have a release() function, "
+			"it is broken and must be fixed.\n",
+			dev->bus_id);
+		WARN_ON(1);
+	}
 }
 
 static struct kobj_type ktype_device = {


  reply	other threads:[~2003-08-15 18:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-15 18:25 [BK PATCH] Driver Core fixes for 2.6.0-test3 Greg KH
2003-08-15 18:25 ` [PATCH] " Greg KH
2003-08-15 18:25   ` Greg KH
2003-08-15 18:25     ` Greg KH
2003-08-15 18:25       ` Greg KH
2003-08-15 18:25         ` Greg KH
2003-08-15 18:25           ` Greg KH
2003-08-15 18:25             ` Greg KH [this message]
     [not found] ` <20030815215459.Y639@nightmaster.csn.tu-chemnitz.de>
2003-08-16  3:28   ` [BK PATCH] " Greg KH
2003-08-16 11:09     ` Ingo Oeser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10609719491100@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox