driver: Fix unregister device after device probe failure
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>
This commit is contained in:
parent
c976b06e16
commit
46bb3a4d84
|
@ -101,6 +101,8 @@ int device_probe(struct device_d *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
list_del(&dev->active);
|
list_del(&dev->active);
|
||||||
|
INIT_LIST_HEAD(&dev->active);
|
||||||
|
|
||||||
dev_err(dev, "probe failed: %s\n", strerror(-ret));
|
dev_err(dev, "probe failed: %s\n", strerror(-ret));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -258,6 +260,8 @@ static int device_probe_deferred(void)
|
||||||
|
|
||||||
list_for_each_entry_safe(dev, tmp, &deferred, active) {
|
list_for_each_entry_safe(dev, tmp, &deferred, active) {
|
||||||
list_del(&dev->active);
|
list_del(&dev->active);
|
||||||
|
INIT_LIST_HEAD(&dev->active);
|
||||||
|
|
||||||
dev_dbg(dev, "re-probe device\n");
|
dev_dbg(dev, "re-probe device\n");
|
||||||
bus_for_each_driver(dev->bus, drv) {
|
bus_for_each_driver(dev->bus, drv) {
|
||||||
if (match(drv, dev))
|
if (match(drv, dev))
|
||||||
|
|
Loading…
Reference in New Issue