bootdev: Fix the case where the driver ops field is null.
In the case where a bootdev does not have a custom get_bootflow function but instead relies on default_get_bootflow to provide one, bootdev_get_bootflow was not handling the case where ops was simply not set. Restructure the function to check for "ops && ops->get_bootflow" and add appropriate log_debug calls for both cases. Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
+10
-5
@@ -566,13 +566,18 @@ int bootdev_get_bootflow(struct udevice *dev, struct bootflow_iter *iter,
|
||||
{
|
||||
const struct bootdev_ops *ops = bootdev_get_ops(dev);
|
||||
|
||||
log_debug("->get_bootflow %s,%x=%p\n", dev->name, iter->part,
|
||||
ops->get_bootflow);
|
||||
bootflow_init(bflow, dev, iter->method);
|
||||
if (!ops->get_bootflow)
|
||||
return default_get_bootflow(dev, iter, bflow);
|
||||
|
||||
return ops->get_bootflow(dev, iter, bflow);
|
||||
if (ops && ops->get_bootflow) {
|
||||
log_debug("->get_bootflow %s,%x=%p\n", dev->name, iter->part,
|
||||
ops->get_bootflow);
|
||||
|
||||
return ops->get_bootflow(dev, iter, bflow);
|
||||
}
|
||||
|
||||
log_debug("->get_bootflow %s,%x is unset\n", dev->name, iter->part);
|
||||
|
||||
return default_get_bootflow(dev, iter, bflow);
|
||||
}
|
||||
|
||||
int bootdev_next_label(struct bootflow_iter *iter, struct udevice **devp,
|
||||
|
||||
Reference in New Issue
Block a user