From: Songjun Wu <songjun.wu@microchip.com>
To: <gregkh@linuxfoundation.org>, <linux-kernel@vger.kernel.org>
Cc: Songjun Wu <songjun.wu@microchip.com>
Subject: [PATCH] kobject: set state_initialized to 0 in kobject_cleanup
Date: Tue, 1 Nov 2016 18:41:44 +0800 [thread overview]
Message-ID: <1477996905-16920-1-git-send-email-songjun.wu@microchip.com> (raw)
If state_initialized is not set to 0 when a kobject is
released, a device is registered, unregistered, and
registered again, the error below will occur.
kobject (dec04bb0): tried to init an initialized object,
something is seriously wrong.
Signed-off-by: Songjun Wu <songjun.wu@microchip.com>
---
lib/kobject.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/kobject.c b/lib/kobject.c
index 445dcae..423af4e 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -639,6 +639,8 @@ static void kobject_cleanup(struct kobject *kobj)
kobject_del(kobj);
}
+ kobj->state_initialized = 0;
+
if (t && t->release) {
pr_debug("kobject: '%s' (%p): calling ktype release\n",
kobject_name(kobj), kobj);
--
2.7.4
next reply other threads:[~2016-11-01 10:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-01 10:41 Songjun Wu [this message]
2016-11-01 14:56 ` [PATCH] kobject: set state_initialized to 0 in kobject_cleanup Greg KH
2016-11-02 1:29 ` Wu, Songjun
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=1477996905-16920-1-git-send-email-songjun.wu@microchip.com \
--to=songjun.wu@microchip.com \
--cc=gregkh@linuxfoundation.org \
--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;
as well as URLs for NNTP newsgroup(s).