Skip to contentSkip to conversation

video: arm: rpi: Bail out early if querying video information fails

PATCH New matthias.bgg at kernel.org 3 participants 3 messages Jul 11, 2019 – Jul 29, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: arm: rpi: Bail out early if querying video information fails

From: Fabian Vogt <[email protected]>

When probing we query for the width and hight of the display. If the firmware does not report any connected display the system will crash. See https://github.com/raspberrypi/firmware/issues/1157 for details.

[mb: update commit message]
---
 drivers/video/bcm2835.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/bcm2835.c +3 -1
index bc41090aed..1d2eda084c 100644
@@ -19,13 +19,15 @@ static int bcm2835_video_probe(struct udevice *dev)
 
 	debug("bcm2835: Query resolution...\n");
 	ret = bcm2835_get_video_size(&w, &h);
-	if (ret)
+	if (ret || w == 0 || h == 0)
 		return -EIO;
 
 	debug("bcm2835: Setting up display for %d x %d\n", w, h);
 	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 -EIO;
 
 	debug("bcm2835: Final resolution is %d x %d\n", w, h);
 
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/1 video: arm: rpi: Bail out early if querying video information fails

On Thu, 11 Jul 2019 16:56:24 +0200
matthias.bgg at kernel.org wrote:

Hi,

Quoted 9 lines

From: Fabian Vogt <[email protected]>

When probing we query for the width and hight of the display. If the firmware does not report any connected display the system will crash. See https://github.com/raspberrypi/firmware/issues/1157 for details.

[mb: update commit message]

We could just propagate the value of ret instead of coalescing every error to EIO, but that's just a nit, so:

I think this should be merged now, as on the RPi4 this is somewhat of a showstopper, because we don't have PCIe yet, so no USB, and no keyboard support. Which means serial console is the only way to control U-Boot.

Cheers,
Andre.

Quoted 25 lines
---
 drivers/video/bcm2835.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/bcm2835.c +3 -1
index bc41090aed..1d2eda084c 100644
@@ -19,13 +19,15 @@ static int bcm2835_video_probe(struct udevice *dev)
 
 	debug("bcm2835: Query resolution...\n");
 	ret = bcm2835_get_video_size(&w, &h);
-	if (ret)
+	if (ret || w == 0 || h == 0)
 		return -EIO;
 
 	debug("bcm2835: Setting up display for %d x %d\n", w, h);
 	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 -EIO;
 
 	debug("bcm2835: Final resolution is %d x %d\n", w, h);
 
#2 lore raw

PATCH 1/1 video: arm: rpi: Bail out early if querying video information fails

In reply to matthias.bgg at kernel.org

On Thu, 11 Jul 2019 16:56:24 +0200
matthias.bgg at kernel.org matthias.bgg at kernel.org wrote:
...

Quoted 2 lines
 drivers/video/bcm2835.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Applied to u-boot-video/master, thanks!

--
Anatolij