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: 10697573 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 234DA14E2 for ; Mon, 26 Nov 2018 04:14:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 129A1288C3 for ; Mon, 26 Nov 2018 04:14:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06DAF29500; Mon, 26 Nov 2018 04:14:26 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8FAF288C3 for ; Mon, 26 Nov 2018 04:14:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2EC476E2C1; Mon, 26 Nov 2018 04:12:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by gabe.freedesktop.org (Postfix) with ESMTPS id C122689A14 for ; Mon, 26 Nov 2018 04:07:43 +0000 (UTC) Received: by mail-pl1-x644.google.com with SMTP id p8so2921328plo.2 for ; Sun, 25 Nov 2018 20:07:43 -0800 (PST) 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=UulJFDEZ+Czl8vxmfQpg9AZXH9RkYpx5F8b12fwkgerDhX4GoiMer9dJg4B0OE4VKL Mvy8DAlwBvT/qtGVzZ4QxqdK/10wlYbdEI2n4/KqR9X4OUMEurNdyD3L/MhCDsco4LD5 ETgCuYdQz2Yi+icFfNnOVYNNRoSY94/tMvoMJVCpeG+yef7sEinZgSnN8BBNGxJ9MMBp cXCKjRE4M2gG9hXb2ypeb3AkUuBBGg8WIgeKxy4h/UG59c9s3xRgoNKZRm02Wv6KPJLB QEThv+GJCywWinzIEz46w37IjBaKKoyAdWLHS10z28ALjOl9gJwAb3/cQp22MajebR2c hVyA== X-Gm-Message-State: AA+aEWaPaotjBtsiU442JBib5xqdEFhSFTQ+QLuRoMqiF/T82sRn/8m7 BDyLWsyJAw5ILaqvECmLKyMrzA== 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development 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, Matthias Brugger , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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)