From patchwork Thu Jul 11 14:56:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Brugger X-Patchwork-Id: 1130837 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="D8mkL79P"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45kzfR74vdz9sN6 for ; Fri, 12 Jul 2019 00:56:45 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 0093DC21DA2; Thu, 11 Jul 2019 14:56:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 79B5FC21C3F; Thu, 11 Jul 2019 14:56:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 88F9CC21C3F; Thu, 11 Jul 2019 14:56:36 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by lists.denx.de (Postfix) with ESMTPS id 0959FC21C38 for ; Thu, 11 Jul 2019 14:56:36 +0000 (UTC) Received: from ziggy.de (unknown [37.223.141.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 44A1B2166E; Thu, 11 Jul 2019 14:56:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562856994; bh=ljgX94oetySAYC/HMJzB+m6JT0x8cJ8pDVvE+UFCW8o=; h=From:To:Cc:Subject:Date:From; b=D8mkL79PrbpWF/vr0d8Ppx/LOYrBLRg1si5v7g86prLQKRMfhAK8hhFNpqgHSRmdC 8Bt5w9uWUiNSLJUu0AMjAeQ9/RpIIV44wo8RMuhb/1XwII7Lo78gvzJcYaglMUGHWV B+C21iWqxqgBlPQT4c27gef/evfPJZcVW7oBjLWI= From: matthias.bgg@kernel.org To: mbrugger@suse.com, agust@denx.de, u-boot@lists.denx.de Date: Thu, 11 Jul 2019 16:56:24 +0200 Message-Id: <20190711145624.23007-1-matthias.bgg@kernel.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Cc: Fabian Vogt Subject: [U-Boot] [PATCH] video: arm: rpi: Bail out early if querying video information fails X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Fabian Vogt 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. Signed-off-by: Fabian Vogt [mb: update commit message] Signed-off-by: Matthias Brugger Reviewed-by: Andre Przywara Tested-by: Andre Przywara --- drivers/video/bcm2835.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c index bc41090aed..1d2eda084c 100644 --- a/drivers/video/bcm2835.c +++ b/drivers/video/bcm2835.c @@ -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);