From: Bin Meng Date: Sun, 9 Oct 2016 11:14:17 +0000 (-0700) Subject: dm: video: Don't do anything in alloc_fb() when plat->size is zero X-Git-Tag: v2016.11-rc2~11^2~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3968398eb2d974b4840d7210d8503d7cbd8f4c48;p=u-boot dm: video: Don't do anything in alloc_fb() when plat->size is zero With DM VESA driver on x86 boards, plat->base/size/align are all zeroes and starting address passed to alloc_fb() happens to be 1MB aligned, so this routine does not trigger any issue. On QEMU with U-Boot as coreboot payload, the starting address is within 1MB range (eg: 0x7fb0000), thus causes failure in video_post_bind(). Actually if plat->size is zero, it makes no sense to do anything in this routine. Add such check there. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index b6dd0f5a58..11ca7937dc 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -54,6 +54,9 @@ static ulong alloc_fb(struct udevice *dev, ulong *addrp) struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); ulong base, align, size; + if (!plat->size) + return 0; + align = plat->align ? plat->align : 1 << 20; base = *addrp - plat->size; base &= ~(align - 1);