driver: fix device remove order
The active list is supposed to collect active devices in the opposite order they are probed. This is used to remove the devices in the correct order in devices_shutdown. The order is wrong though when in a drivers probe function other devices are registered. To get the order right we have to add the new device to the active list before it is probed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
a76c62f80d
commit
0f3366ba85
|
@ -85,14 +85,15 @@ int device_probe(struct device_d *dev)
|
|||
|
||||
pinctrl_select_state_default(dev);
|
||||
|
||||
list_add(&dev->active, &active);
|
||||
|
||||
ret = dev->bus->probe(dev);
|
||||
if (ret) {
|
||||
list_del(&dev->active);
|
||||
dev_err(dev, "probe failed: %s\n", strerror(-ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
list_add(&dev->active, &active);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue