From patchwork Mon Jun 13 16:37:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 12879757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4EBCC433EF for ; Mon, 13 Jun 2022 16:37:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D0C810F2A8; Mon, 13 Jun 2022 16:37:14 +0000 (UTC) Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id E6D1B10F29B for ; Mon, 13 Jun 2022 16:37:12 +0000 (UTC) Received: from notapiano.myfiosgateway.com (pool-98-113-53-228.nycmny.fios.verizon.net [98.113.53.228]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madras.collabora.co.uk (Postfix) with ESMTPSA id 3D02B66015CE; Mon, 13 Jun 2022 17:37:09 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1655138231; bh=EU5dXJaxST5yUrirK7LNhLQYTDy3gjAdYEoad2iWgjY=; h=From:To:Cc:Subject:Date:From; b=CcyxbA6+H2CHZ79FccQzbDfT0w5dk+YkS66AasdDCPAvv8TFB9WPHC7NfKZFDi0Af Vv/tku+hO0aNkbqwRybcjgYPhWKBFVe/vFwWIt2TA8xi1++q5t/IFv8+N0WQb2YAg7 QEURcJqXLQVG4oaOczNg9uOO0uIhDOoN+PeMzQF04o8TZrXhO+Gi+xpoL8pkOnJK7K +m50Ww23uZIWODl8ReM8VPEcG0tW4KT7cLNa7N9tIjPSBIwtXMssplzkqXEfEgR+GR 31nZPaZVj4ZZqqX4pQzah0dkMdqw9+HI5IFf+V7nR1P6gZp94VcBD4AX2fxTSC9T+F mDNW0HZDIGjSA== From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= To: Robert Foss Subject: [PATCH] drm/bridge: anx7625: Zero error variable when panel bridge not present Date: Mon, 13 Jun 2022 12:37:05 -0400 Message-Id: <20220613163705.1531721-1-nfraprado@collabora.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrzej Hajda , =?utf-8?b?TsOtY29sYXMgRi4gUi4g?= =?utf-8?b?QS4gUHJhZG8=?= , Jonas Karlman , David Airlie , Thomas Zimmermann , dri-devel@lists.freedesktop.org, Neil Armstrong , linux-kernel@vger.kernel.org, Jernej Skrabec , Tzung-Bi Shih , Laurent Pinchart , Hsin-Yi Wang , =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= , Maxime Ripard , kernel@collabora.com, Sam Ravnborg , Xin Ji , AngeloGioacchino Del Regno Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" While parsing the DT, the anx7625 driver checks for the presence of a panel bridge on endpoint 1. If it is missing, pdata->panel_bridge stores the error pointer and the function returns successfully without first cleaning that variable. This is an issue since other functions later check for the presence of a panel bridge by testing the trueness of that variable. In order to ensure proper behavior, zero out pdata->panel_bridge before returning when no panel bridge is found. Fixes: 9e82ea0fb1df ("drm/bridge: anx7625: switch to devm_drm_of_get_bridge") Signed-off-by: NĂ­colas F. R. A. Prado Reviewed-by: AngeloGioacchino Del Regno --- drivers/gpu/drm/bridge/analogix/anx7625.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 53a5da6c49dd..3aed4de16690 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -1657,8 +1657,10 @@ static int anx7625_parse_dt(struct device *dev, pdata->panel_bridge = devm_drm_of_get_bridge(dev, np, 1, 0); if (IS_ERR(pdata->panel_bridge)) { - if (PTR_ERR(pdata->panel_bridge) == -ENODEV) + if (PTR_ERR(pdata->panel_bridge) == -ENODEV) { + pdata->panel_bridge = NULL; return 0; + } return PTR_ERR(pdata->panel_bridge); }