[U-Boot] [PATCH] video: arm: rpi: Avoid crash without HDMI monitor connected

Before we use random pointers that bcm2835_set_video_params() is supposed to populate, we should check its return value, which could indicate that the function bailed out early. This happend when there is no monitor connected.
That fixes a horrible crash when just booting with a serial console.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- Hi,
I saw this on the RPi4 (with Andrei's v2 series), but it looks like this would happen on the other boards as well.
Cheers, Andre.
drivers/video/bcm2835.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c index bc41090aed..4188a94cba 100644 --- a/drivers/video/bcm2835.c +++ b/drivers/video/bcm2835.c @@ -26,6 +26,8 @@ static int bcm2835_video_probe(struct udevice *dev) ret = bcm2835_set_video_params(&w, &h, 32, BCM2835_MBOX_PIXEL_ORDER_RGB, BCM2835_MBOX_ALPHA_MODE_IGNORED, &fb_base, &fb_size, &pitch); + if (ret) + return ret;
debug("bcm2835: Final resolution is %d x %d\n", w, h);

On Fri, 26 Jul 2019 13:54:30 +0100 Andre Przywara andre.przywara@arm.com wrote: ...
I saw this on the RPi4 (with Andrei's v2 series), but it looks like this would happen on the other boards as well.
Thanks, but I've applied [1] instead of this patch.
[1] http://patchwork.ozlabs.org/patch/1130837
-- Anatolij
participants (2)
-
Anatolij Gustschin
-
Andre Przywara