From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: jbe@pengutronix.de
Subject: [PATCH] driver: Fix unregister device after device probe failure
Date: Mon, 8 Feb 2016 11:43:13 +0100 [thread overview]
Message-ID: <1454928193-19306-1-git-send-email-s.hauer@pengutronix.de> (raw)
When a device probe fails the device is removed from the active list.
If then the device is unregistered afterwards it is removed from the
active list again resulting in a crash. To fix this initialize the
devices active list entry when removing it from the active list.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/base/driver.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index a70fbb2..c529296 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -101,6 +101,8 @@ int device_probe(struct device_d *dev)
}
list_del(&dev->active);
+ INIT_LIST_HEAD(&dev->active);
+
dev_err(dev, "probe failed: %s\n", strerror(-ret));
return ret;
@@ -258,6 +260,8 @@ static int device_probe_deferred(void)
list_for_each_entry_safe(dev, tmp, &deferred, active) {
list_del(&dev->active);
+ INIT_LIST_HEAD(&dev->active);
+
dev_dbg(dev, "re-probe device\n");
bus_for_each_driver(dev->bus, drv) {
if (match(drv, dev))
--
2.7.0.rc3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2016-02-08 10:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-08 10:43 Sascha Hauer [this message]
2016-02-08 11:33 ` Juergen Borleis
2016-02-08 17:43 ` Robert Schwebel
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=1454928193-19306-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=jbe@pengutronix.de \
/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