From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Driver Core patches for 2.6.6
Date: Fri, 14 May 2004 16:07:23 -0700 [thread overview]
Message-ID: <10845760434173@kroah.com> (raw)
In-Reply-To: <10845760433004@kroah.com>
ChangeSet 1.1587.5.25, 2004/05/11 16:31:46-07:00, maneesh@in.ibm.com
[PATCH] kobject_set_name - error handling
1) kobject_set_name-cleanup-01.patch
This patch corrects the following by checking the reutrn code from
kobject_set_name().
bus_add_driver()
bus_register()
sys_dev_register()
o The following patch cleansup the kobject_set_name() users. Basically checking
return code from kobject_set_name(). There can be error returns like -ENOMEM
or -EFAULT from kobject_set_name() if the name length exceeds KOBJ_NAME_LEN.
drivers/base/bus.c | 11 +++++++++--
drivers/base/sys.c | 5 ++++-
2 files changed, 13 insertions(+), 3 deletions(-)
diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
--- a/drivers/base/bus.c Fri May 14 15:56:41 2004
+++ b/drivers/base/bus.c Fri May 14 15:56:41 2004
@@ -451,7 +451,11 @@
if (bus) {
pr_debug("bus %s: add driver %s\n",bus->name,drv->name);
- kobject_set_name(&drv->kobj,drv->name);
+ error = kobject_set_name(&drv->kobj,drv->name);
+ if (error) {
+ put_bus(bus);
+ return error;
+ }
drv->kobj.kset = &bus->drivers;
if ((error = kobject_register(&drv->kobj))) {
put_bus(bus);
@@ -557,7 +561,10 @@
{
int retval;
- kobject_set_name(&bus->subsys.kset.kobj,bus->name);
+ retval = kobject_set_name(&bus->subsys.kset.kobj,bus->name);
+ if (retval)
+ goto out;
+
subsys_set_kset(bus,bus_subsys);
retval = subsystem_register(&bus->subsys);
if (retval)
diff -Nru a/drivers/base/sys.c b/drivers/base/sys.c
--- a/drivers/base/sys.c Fri May 14 15:56:41 2004
+++ b/drivers/base/sys.c Fri May 14 15:56:41 2004
@@ -180,8 +180,11 @@
/* But make sure we point to the right type for sysfs translation */
sysdev->kobj.ktype = &ktype_sysdev;
- kobject_set_name(&sysdev->kobj,"%s%d",
+ error = kobject_set_name(&sysdev->kobj,"%s%d",
kobject_name(&cls->kset.kobj),sysdev->id);
+ if (error)
+ return error;
+
pr_debug("Registering sys device '%s'\n",kobject_name(&sysdev->kobj));
/* Register the object */
next prev parent reply other threads:[~2004-05-15 1:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-14 23:06 [BK PATCH] Driver Core patches for 2.6.6 Greg KH
2004-05-14 23:07 ` [PATCH] " Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH [this message]
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:07 ` Greg KH
2004-05-14 23:24 ` zombies with AMD64 and 32 bit userspace with 2.6 David Lang
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=10845760434173@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