video: vidconsole: Fix null dereference of ops->measure

At present vidconsole_measure() tests ops->select_font before calling
ops->measure, which would result in a null dereference when the console
driver provides no ops for measure.

Fixes: b828ed7d7929 ("console: Allow measuring the bounding box of text")
Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Bin Meng 2023-08-03 17:32:41 +08:00 committed by Anatolij Gustschin
parent a5899cc69a
commit 01c76f1a64

View File

@ -603,7 +603,7 @@ int vidconsole_measure(struct udevice *dev, const char *name, uint size,
struct vidconsole_ops *ops = vidconsole_get_ops(dev);
int ret;
if (ops->select_font) {
if (ops->measure) {
ret = ops->measure(dev, name, size, text, bbox);
if (ret != -ENOSYS)
return ret;