[<prev] [next>] [day] [month] [year] [list]
Message-ID: <a8e1da0905102318w52d331fbv60849dd362906296@mail.gmail.com>
Date: Mon, 11 May 2009 14:18:55 +0800
From: Dave Young <hidave.darkstar@...il.com>
To: Greg KH <gregkh@...e.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH 3/3] driver-core : make sysdev_class_register check
kobject_set_name return value
sysdev_class_register should check the kobject_set_name return value.
Add the return value checking code.
Signed-off-by: Dave Young <hidave.darkstar@...il.com>
---
drivers/base/sys.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff -uprN linux.old/drivers/base/sys.c linux.new/drivers/base/sys.c
--- linux.old/drivers/base/sys.c 2009-05-11 13:59:16.000000000 +0800
+++ linux.new/drivers/base/sys.c 2009-05-11 14:01:16.000000000 +0800
@@ -131,6 +131,8 @@ static struct kset *system_kset;
int sysdev_class_register(struct sysdev_class *cls)
{
+ int retval;
+
pr_debug("Registering sysdev class '%s'\n", cls->name);
INIT_LIST_HEAD(&cls->drivers);
@@ -138,7 +140,11 @@ int sysdev_class_register(struct sysdev_
cls->kset.kobj.parent = &system_kset->kobj;
cls->kset.kobj.ktype = &ktype_sysdev_class;
cls->kset.kobj.kset = system_kset;
- kobject_set_name(&cls->kset.kobj, cls->name);
+
+ retval = kobject_set_name(&cls->kset.kobj, cls->name);
+ if (retval)
+ return retval;
+
return kset_register(&cls->kset);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists