dm: core: Add logging on unbind failure
This failure path is tricky to debug since it continues after failure and there are a lot of error paths. Add logging to help. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
0688b758a2
commit
8474da946f
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <log.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <dm/device.h>
|
#include <dm/device.h>
|
||||||
#include <dm/device-internal.h>
|
#include <dm/device-internal.h>
|
||||||
@ -30,11 +31,14 @@ int device_chld_unbind(struct udevice *dev, struct driver *drv)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
ret = device_unbind(pos);
|
ret = device_unbind(pos);
|
||||||
if (ret && !saved_ret)
|
if (ret && !saved_ret) {
|
||||||
|
log_warning("device '%s' failed to unbind\n",
|
||||||
|
pos->name);
|
||||||
saved_ret = ret;
|
saved_ret = ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return saved_ret;
|
return log_ret(saved_ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
int device_chld_remove(struct udevice *dev, struct driver *drv,
|
int device_chld_remove(struct udevice *dev, struct driver *drv,
|
||||||
@ -63,13 +67,13 @@ int device_unbind(struct udevice *dev)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return -EINVAL;
|
return log_msg_ret("dev", -EINVAL);
|
||||||
|
|
||||||
if (dev->flags & DM_FLAG_ACTIVATED)
|
if (dev->flags & DM_FLAG_ACTIVATED)
|
||||||
return -EINVAL;
|
return log_msg_ret("active", -EINVAL);
|
||||||
|
|
||||||
if (!(dev->flags & DM_FLAG_BOUND))
|
if (!(dev->flags & DM_FLAG_BOUND))
|
||||||
return -EINVAL;
|
return log_msg_ret("not-bound", -EINVAL);
|
||||||
|
|
||||||
drv = dev->driver;
|
drv = dev->driver;
|
||||||
assert(drv);
|
assert(drv);
|
||||||
@ -77,12 +81,12 @@ int device_unbind(struct udevice *dev)
|
|||||||
if (drv->unbind) {
|
if (drv->unbind) {
|
||||||
ret = drv->unbind(dev);
|
ret = drv->unbind(dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return log_msg_ret("unbind", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = device_chld_unbind(dev, NULL);
|
ret = device_chld_unbind(dev, NULL);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return log_msg_ret("child unbind", ret);
|
||||||
|
|
||||||
if (dev->flags & DM_FLAG_ALLOC_PDATA) {
|
if (dev->flags & DM_FLAG_ALLOC_PDATA) {
|
||||||
free(dev->platdata);
|
free(dev->platdata);
|
||||||
@ -98,7 +102,7 @@ int device_unbind(struct udevice *dev)
|
|||||||
}
|
}
|
||||||
ret = uclass_unbind_device(dev);
|
ret = uclass_unbind_device(dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return log_msg_ret("uc", ret);
|
||||||
|
|
||||||
if (dev->parent)
|
if (dev->parent)
|
||||||
list_del(&dev->sibling_node);
|
list_del(&dev->sibling_node);
|
||||||
|
@ -120,10 +120,10 @@ int uclass_destroy(struct uclass *uc)
|
|||||||
uclass_node);
|
uclass_node);
|
||||||
ret = device_remove(dev, DM_REMOVE_NORMAL);
|
ret = device_remove(dev, DM_REMOVE_NORMAL);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return log_msg_ret("remove", ret);
|
||||||
ret = device_unbind(dev);
|
ret = device_unbind(dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return log_msg_ret("unbind", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
uc_drv = uc->uc_drv;
|
uc_drv = uc->uc_drv;
|
||||||
|
Loading…
Reference in New Issue
Block a user