From patchwork Mon Nov 26 04:07:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 10697537 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7347214E2 for ; Mon, 26 Nov 2018 04:08:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53968297E9 for ; Mon, 26 Nov 2018 04:08:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45AB5297FC; Mon, 26 Nov 2018 04:08:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E315D297E9 for ; Mon, 26 Nov 2018 04:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=DVgMIWfeWGU6E9gWofgsEwEk7uJgDv12Ch1Q8mMAE+U=; b=WwQxzCS1V3Xozw zlqnJ9UUCZmBIQ+fV8PoelH0S9la9FMxKGk126OSMhagPmRCGnOzei56bipqfQ8CZnvGIn9EFhtKe dgBAy2PWL+/wYskaY/oKLbdmT2cMExd+ikKX4iM2/cFs/qhWPR3a7OEucoBM4QRKpWA2hdLZ/CD2R o3cozoswoPZVi3x1rj0J+yF301cnpxnARK3rvDhHp9bnax6aUhioNObEY+3vvGz4z/AX6mls6nzsi 2GLAe3trPgK/ZH2BN4OusRtDeO0VxYAAQtbM11qrcCwDoMmuNAb3pKu3/c7mLnh3HN1KIKG2MdoTp mmzY5h4WhTdbyQ1m4XxQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gR8Bj-0008Aj-4R; Mon, 26 Nov 2018 04:07:59 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gR8Bf-00089l-Gu for linux-mediatek@lists.infradead.org; Mon, 26 Nov 2018 04:07:56 +0000 Received: by mail-pl1-x644.google.com with SMTP id g9so735511plo.3 for ; Sun, 25 Nov 2018 20:07:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PcYxqSLEBxrtZEfSqHikCvgwNVEYCzsR6Neext4Petc=; b=dVeccttXPOe83UTvldqsO0tINFcU9nwZGHJL2cfuqxJOPjVd86Dlbgj0ndSc1dT/Mk YZW3FyiITIXq3gkUBvpgpsHWTAxN/Al3pMp83rZZZ6EV6h0FiOapn0G+VqwPOzZ8ITLr sxkty9Y1YkU+61p23PufbvKPZB2ffffQjHwww= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PcYxqSLEBxrtZEfSqHikCvgwNVEYCzsR6Neext4Petc=; b=BnIZAHOJhd641kiNp0SbhM801AdifSvQi+nLT+MGjiDmxlf1ZMPTtL6+3Q+5eFiPPV ac9UoMAvQ0P5qaZKlA82rDErw5WN9KkW2ZbmssS4Doo/RjzTXiQLr1UWb9b3Hb395OpR 5iltqNgJfAtO4VzTAKlhN/KYAXaAZ42vap8nCrrB0NLG5Fr5sOIlAbAd0e3pyC3PGkyH phe4idHn5b03vn+o2n8spXVFIo5eEso8z/TrDIfAm4DUVEY0EMwkyNWFG11hjVwJefIz /z2Fchdj0jBjsVm18UXqWXdJfWCySKRmMwbJvBmuLuJlYzPIFLICawpD2e+Ch1QDWXt/ tqgA== X-Gm-Message-State: AA+aEWatCfREG8LMIw1FMZk/4yY52WG5jGmvX0bOMR3J5VPdGRWxOyIO uuuXE6EaRFu0V1jfO4RD2NbwXQ== X-Google-Smtp-Source: AFSGD/XYJeDqVnbpbn90RhEzYvePjSInjbew6UjZgBGUNcoJizDG2SfV3Hw4WdEiCa93JpAvDGswWA== X-Received: by 2002:a17:902:b78b:: with SMTP id e11mr25988753pls.90.1543205263235; Sun, 25 Nov 2018 20:07:43 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:f659:7f17:ea11:4e8e]) by smtp.gmail.com with ESMTPSA id w136sm55833132pfd.169.2018.11.25.20.07.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Nov 2018 20:07:42 -0800 (PST) From: Nicolas Boichat To: CK Hu Subject: [PATCH] drm/mediatek: Only try to attach bridge if there is one Date: Mon, 26 Nov 2018 12:07:37 +0800 Message-Id: <20181126040737.138682-1-drinkcat@chromium.org> X-Mailer: git-send-email 2.20.0.rc0.387.gc7a69e6b6c-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181125_200755_564990_289B2494 X-CRM114-Status: GOOD ( 12.69 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Philipp Zabel , Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Even if dsi->bridge is NULL, we still try to call drm_bridge_attach, and print out an error message, before creating the connector. When no bridge is provided, let's skip these 2 steps and directly create the connector. Signed-off-by: Nicolas Boichat Reviewed-by: CK Hu Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/mediatek/mtk_dsi.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 66df1b17795921..27b507eb4a997d 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -818,10 +818,13 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi) dsi->encoder.possible_crtcs = 1; /* If there's a bridge, attach to it and let it create the connector */ - ret = drm_bridge_attach(&dsi->encoder, dsi->bridge, NULL); - if (ret) { - DRM_ERROR("Failed to attach bridge to drm\n"); - + if (dsi->bridge) { + ret = drm_bridge_attach(&dsi->encoder, dsi->bridge, NULL); + if (ret) { + DRM_ERROR("Failed to attach bridge to drm\n"); + goto err_encoder_cleanup; + } + } else { /* Otherwise create our own connector and attach to a panel */ ret = mtk_dsi_create_connector(drm, dsi); if (ret)