aboutsummaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-08-23 10:25:25 +0200
committerSimon Glass <sjg@chromium.org>2022-08-26 16:32:59 -0600
commitd81eeacd48f760516abf12e69aba4ce5dd44545f (patch)
tree2a0af2e9adaec6e17bdd338f03248999f0516e48 /boot
parenta7091f3f8c859a29ad63b94952472bd93d60488c (diff)
downloadu-boot-d81eeacd48f760516abf12e69aba4ce5dd44545f.zip
u-boot-d81eeacd48f760516abf12e69aba4ce5dd44545f.tar.gz
u-boot-d81eeacd48f760516abf12e69aba4ce5dd44545f.tar.bz2
boot: fix vbe_find_first_device()
uclass_find_first_device() may return NULL if no device for the uclass exists. Handle this case gracefully. Addresses-Coverity: CID 356244 ("Null pointer dereferences (FORWARD_NULL)") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot')
-rw-r--r--boot/vbe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/boot/vbe.c b/boot/vbe.c
index e6ee087..52b3283 100644
--- a/boot/vbe.c
+++ b/boot/vbe.c
@@ -40,7 +40,7 @@ int vbe_find_next_device(struct udevice **devp)
int vbe_find_first_device(struct udevice **devp)
{
uclass_find_first_device(UCLASS_BOOTMETH, devp);
- if (*devp && is_vbe(*devp))
+ if (!*devp || is_vbe(*devp))
return 0;
return vbe_find_next_device(devp);