[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1205196914-17965-1-git-send-email-gregkh@suse.de>
Date: Mon, 10 Mar 2008 17:55:11 -0700
From: Greg Kroah-Hartman <gregkh@...e.de>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...e.de>,
Balaji Rao <balajirrao@...il.com>
Subject: [PATCH 1/4] sysdev: fix problem with sysdev_class being re-registered
We need to initialize the kobject for a sysdev_class as it could have
been recycled (stupid static kobjects...)
We also do the same thing in case sysdev devices are being
re-registered.
Thanks to Balaji Rao <balajirrao@...il.com> for pointing out the
problem.
Signed-off-by: Balaji Rao <balajirrao@...il.com>
Tested-by: Mikael Pettersson <mikpe@...uu.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@...e.de>
---
drivers/base/sys.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 2f79c55..8e13fd9 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -133,6 +133,7 @@ int sysdev_class_register(struct sysdev_class * cls)
pr_debug("Registering sysdev class '%s'\n",
kobject_name(&cls->kset.kobj));
INIT_LIST_HEAD(&cls->drivers);
+ memset(&cls->kset.kobj, 0x00, sizeof(struct kobject));
cls->kset.kobj.parent = &system_kset->kobj;
cls->kset.kobj.ktype = &ktype_sysdev_class;
cls->kset.kobj.kset = system_kset;
@@ -227,6 +228,9 @@ int sysdev_register(struct sys_device * sysdev)
pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj));
+ /* initialize the kobject to 0, in case it had previously been used */
+ memset(&sysdev->kobj, 0x00, sizeof(struct kobject));
+
/* Make sure the kset is set */
sysdev->kobj.kset = &cls->kset;
--
1.5.4.3
--
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