Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp756196iog; Mon, 13 Jun 2022 12:14:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vODDQ9cmTboZLDHNMw72/Yp63QzzeFz59+V+z6THfZHOpJ2t5ZVTowyLunQ+P45+7jHdvK X-Received: by 2002:a17:90b:1e4e:b0:1e3:47e4:92b6 with SMTP id pi14-20020a17090b1e4e00b001e347e492b6mr227814pjb.47.1655147656559; Mon, 13 Jun 2022 12:14:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655147656; cv=none; d=google.com; s=arc-20160816; b=ne2zV8lR4dRK1DQQT8iWmlyc3+NpWCntz8rQHMhKKFKLhDGzrrnGYYwKiO9NnSIq6Z 6dT8Y54ki1VNuwf8AXDkB0zjVlZCsklY1tYuVr3QiQRpG52z9GXCCimA3JOIUMUXkyX5 rbt2LR7J0h51EaaFRCQP4/mnrh87/pKlHo530bH9XkifLU/69aqNofGI7ARe+5xVUU/N +/imuVVeYIzluwUe3L78XB473/0IbWJlrhMeBsW1FUQ7GDKiRfVuyUHZEc2kufs34N8x GpVG28WNmsTiAVNMjU5N65fQbX/r/6dSwszuBzyT+glWhUXHFk6rxHXLf2HJGkAByNT+ Lw/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hgqSVn3GcyzmSdzq3WmXoxoVG2UBv+Ub0BQjE07pc2A=; b=mywn5IjZv+6+kLB8Wu+T1xDnKfKeowF+OGCSw2rZxTcTpT7T170VD9TFioEhjm3jyt 532XjdcuvrTNMLjsv5YyBHc14Jt0W1bLk3lhP7EgsJjZ/BRquyWG5wAIpaKNKhJvzL4e TPLMUj7H/RC/D1daGuvvqpbRM7hgpG1KH7oliUiAV+gBa6zmOj0PR4qF2bjQX13wB9J+ jA1x7ApIBN5ouoTMrl9rAb/l7fq43QUa9u+EsVPyyola8rwlSKjkWHnA/3zR2UQCgELp 7h1k2E6zGfPaAjVPCDfOdofwzQm0luUsyc72dXNJafL6VBOp2I/DmtkSLCAYEWTMQr2Z XS2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=CcyxbA6+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w3-20020a170902a70300b00168e62f2907si1924328plq.110.2022.06.13.12.14.04; Mon, 13 Jun 2022 12:14:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=CcyxbA6+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346691AbiFMTDK (ORCPT + 99 others); Mon, 13 Jun 2022 15:03:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346301AbiFMTCk (ORCPT ); Mon, 13 Jun 2022 15:02:40 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFC6612A89 for ; Mon, 13 Jun 2022 09:37:12 -0700 (PDT) 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?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= To: Robert Foss Cc: kernel@collabora.com, AngeloGioacchino Del Regno , =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= , Andrzej Hajda , Daniel Vetter , David Airlie , Hsin-Yi Wang , Jernej Skrabec , Jonas Karlman , =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Laurent Pinchart , Maxime Ripard , Neil Armstrong , Sam Ravnborg , Thomas Zimmermann , Tzung-Bi Shih , Xin Ji , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); } -- 2.36.1