mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] driver: Fix unregister device after device probe failure
@ 2016-02-08 10:43 Sascha Hauer
  2016-02-08 11:33 ` Juergen Borleis
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2016-02-08 10:43 UTC (permalink / raw)
  To: Barebox List; +Cc: jbe

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] driver: Fix unregister device after device probe failure
  2016-02-08 10:43 [PATCH] driver: Fix unregister device after device probe failure Sascha Hauer
@ 2016-02-08 11:33 ` Juergen Borleis
  2016-02-08 17:43   ` Robert Schwebel
  0 siblings, 1 reply; 3+ messages in thread
From: Juergen Borleis @ 2016-02-08 11:33 UTC (permalink / raw)
  To: barebox

On Monday 08 February 2016 11:43:13 Sascha Hauer wrote:
> 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>

Tested-by: Juergen Borleis <j.borleis@pengutroni.de>

jb
-- 
Pengutronix e.K.                              | Juergen Borleis             |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] driver: Fix unregister device after device probe failure
  2016-02-08 11:33 ` Juergen Borleis
@ 2016-02-08 17:43   ` Robert Schwebel
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Schwebel @ 2016-02-08 17:43 UTC (permalink / raw)
  To: Juergen Borleis; +Cc: barebox

On Mon, Feb 08, 2016 at 12:33:32PM +0100, Juergen Borleis wrote:
> On Monday 08 February 2016 11:43:13 Sascha Hauer wrote:
> > 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>
> 
> Tested-by: Juergen Borleis <j.borleis@pengutroni.de>
                                                  x
rsc 
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-08 17:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-08 10:43 [PATCH] driver: Fix unregister device after device probe failure Sascha Hauer
2016-02-08 11:33 ` Juergen Borleis
2016-02-08 17:43   ` Robert Schwebel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox