From patchwork Mon Feb 13 08:56:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13137949 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 CC82FC636D4 for ; Mon, 13 Feb 2023 08:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1WYqGAMyyeSzHlWiJvYNTLlLBKFtwVYCRcA+em3xSdw=; b=k7rgRHt4v4wGgx vuymk6m7hFhVkt4uenlk81k5RYqCwrWLtTg0hGIAos4eOsbwGbuAwriLqD9bZ/WkUBdh8N6lfAK3H gMNNYxf3VTlswdrWtCd0RkaA+2fb9get+61csq5yT65P3hZL7qan84q96JopIackj4oCR+5Wamzi+ oLnZpl+TCjpjGTCQ3ODMApkyzCwoXru280mOo0Vtzqt9FicORu4KuxhM9HZhHhGl7e10tTy7kjPzH c8rq3u/yy13vBGdnkev+qPZsIWX9kwEsH8K5DBjGdQZ/PX2xcqaZhpzTCDjwHP+e8zvM8x6Y1ngeY Svbcp6HER+ziUILD5+Kg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pRUcS-00Dg88-1N; Mon, 13 Feb 2023 08:55:28 +0000 Received: from mail-db8eur05on20601.outbound.protection.outlook.com ([2a01:111:f400:7e1a::601] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pRUcM-00Dg4y-Sj for linux-arm-kernel@lists.infradead.org; Mon, 13 Feb 2023 08:55:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V073yHrwnl0guTrdzfUrVjL0dn1xG1yE/kqHPv+k6+2RXR1E2pUslMayB9UTRWSaX+Aa6JPEn6NSP5Ut2/dQoPNLhPWBPSIPNc59+Ki40jWz1M6EN8ZkFMWrhYUNZajwUgLrPa2bxBNIQJvq/4ZJ/iiESlDyPtfNgiSygbmmgUjyAXA7ulLyoQ3YNvmiG7p/ZZjousBMq6nLXvpPkY0WaeGHm471epnNV6diEHL9X+YiUuqOxoGJNG9wgmJahOxALTmKqT2z26uYE9cHoqw9Ub9h5NE+PwMMPANa1bKdmQyfCfu2cQOq7XTXD8P3ERoyVvogl9U+ORg1+MxR2X26GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L6NnXmZ44ctfaktKFPzdLi2unr3ubsu9j8G8/JUVyNU=; b=hwQeu7ehP67u32n6a4fMNIm/wlO0y5WA80wcLMzVRBnEsc375tYbKpmk4+MRVFwgkjoLO6FU9h6QkbWlYORD3OMrjjqXKzjl3EWsrB1IZGU+1lXODFunCYrvqszomLcp0DmyNB9uy3OKJU1TW4MEAyH/masw6pmMPTnJMQ0iO4h9Swu7PY2biN8b5SgBLNfU9+1f30v3ZHe3YPG5cdS7iSRmppJL2yDuXM292dgF5rtpiswW1M6OAqB38rKj4LR6bwF/gAV82MdSxN4ol7Gu+PlKsba+0eVWw5y8sT7WYgbOT28xeaEnu5e1+jG+49NSy97Y2wAWfgflRrWZRIxJ6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L6NnXmZ44ctfaktKFPzdLi2unr3ubsu9j8G8/JUVyNU=; b=Yoi4PFGlgCjGeJkPoHdNVHUbpBDWPYa+GjzDLO+1EYVVjksh55Cz/H47sNctCHjkBFAGBWlDgpC4IM8//9Vf7h/IudCatJ/ZTCxeaW1dpjmhbx/0QuePfvy600FdZkWGkxqF7hLLSOZ1uN931SJG0vcsrR1WodIDY3tDEsNR3HE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA4PR04MB7600.eurprd04.prod.outlook.com (2603:10a6:102:f2::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.24; Mon, 13 Feb 2023 08:55:18 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::5725:92ec:f43e:f5fc]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::5725:92ec:f43e:f5fc%9]) with mapi id 15.20.6086.023; Mon, 13 Feb 2023 08:55:18 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: marex@denx.de, stefan@agner.ch, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, krzysztof.kozlowski@linaro.org, LW@KARO-electronics.de, alexander.stein@ew.tq-group.com Subject: [PATCH v3 2/6] drm: lcdif: Drop unnecessary NULL pointer check on lcdif->bridge Date: Mon, 13 Feb 2023 16:56:08 +0800 Message-Id: <20230213085612.1026538-3-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230213085612.1026538-1-victor.liu@nxp.com> References: <20230213085612.1026538-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0009.apcprd01.prod.exchangelabs.com (2603:1096:4:191::18) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7600:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c4ac0f3-54ee-489f-a698-08db0da007d5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kH6pjT54zSkfCpwQuieUIojh2BM6xlgUMTHTvWW2e9mitbvb6uc5d+ZKaYjk+RT8jJoQIFGemVeJjX2dZ3AGRBJHsmnz5+h9fLWj0YYHJIiHY3nDqknh4PVCz9aw33N4uHXlsNuIPgs/cT5T6jiDt1NJjlakXCT23A4RJ7UKzly0+39v+gM6yMAOLaVXhyhEBFUFxguPg6TuvY1m60j+4+0t7aRf8rwElkjoklPhi9ZpnvGwE/l6qRFPqPWmg46ScMf3sy0TzcyXTy1zvGHnK58J5NtMvQ9Opog58UO+SWwpzXdkDNUgOzulEJ5cTmEVSghJnLqm1wA9QHIfhhoVxTm95NysDvmrDPUZLtk7mvJ4A8StDg4LpsRWOUNCeMeA7LNHQMYUhO8wczS/3MAK3xY7IWe1db4dDKUWVsOdCQsjU6Cb/4n4mskqPCPUaeaKiCxs0oud4jujp9kCSUIrwtR9MHvil0lVOj3EBzLDcD/yW+1WLf+5bl4L/thGqxsWGq/dQeW5JTnXS8XzUH8zE/pu2ufJi1oyxqHTXdjOlqPZ608hzG4cwWpRgGcYGwIAFao5cA9T58WFEIjYM5//bCAh0hIjQPCPer3VAfxnxV59o1nki1ZD2ICFSPdsZ4rwlX0HKX4hyns3pj+bM2hIEqmqBSWBkVhN8fHL9CHci+gjy82JTYwD40VmVtd2DNYdoHg8TsGQOn0fTyClyj22Ww== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(366004)(396003)(39860400002)(346002)(376002)(451199018)(4326008)(8676002)(1076003)(66946007)(316002)(86362001)(36756003)(2616005)(186003)(83380400001)(6512007)(6506007)(38350700002)(38100700002)(26005)(66476007)(7416002)(6666004)(478600001)(6486002)(52116002)(41300700001)(2906002)(66556008)(8936002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JSLu4/LZ1HUxum3HLJCF5pQbu1v0D4SpfM/g7BrsAX2+mKqEKnrfxIqFDac66CyCRCMIPDuZVmfap589qywLNEHOaPNrAzAYXy1ljfhrcKk4F0BwbnoV6B+ZPWetsKgjHfmdF7M4SxQpLee6tkhU/pYznFt1uaAupj+oF0j6PGPiWVdQEqsiDIvkHnTHBjHxR7b2ar/9YBGZcsnR7z5Vt79ss8aAoZ7g7+AMJ3funP/qYmSaM6OcW9yHKn3vzho4FnWBMixZNAveS30b+D01qqqHXRfiaVaEKSYP9FS2YmW+hvVuzkiXhTf9pd94gJWLGwlm+1gpdPdBn8GNM29B9KoB8cNOsmpR6fEpUQqjqBsAHO17WRfaDqAG/tWsGe+c8Xk2N55ZV2aDfL83y0jpAniCwixJz5ALqEM0UID+8vinX+VNx/wyTgD11ij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XidKj832qyBo+4YtuBnohaLWAefnO0Si3b3Gabvs13FCTNOHdlRbCg2GQURI+zhATUELzZAcbAD X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c4ac0f3-54ee-489f-a698-08db0da007d5 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2023 08:55:18.6080 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ycYhzj9qSi6HicPSH9RHRrEtSShYizG1zaPE2sLdKzv+U6dRTvR3YEI4RP5MNpqf8MZ/GMTyTQJ5axmBcT7KYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7600 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230213_005522_947419_251EDCA8 X-CRM114-Status: GOOD ( 13.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A valid bridge is already found in lcdif_attach_bridge() and set to lcdif->bridge, so lcdif->bridge cannot be a NULL pointer. Drop the unnecessary NULL pointer check in KMS stage. Signed-off-by: Liu Ying Reviewed-by: Alexander Stein --- v2->v3: * No change. v1->v2: * Split from patch 2/2 in v1. (Marek, Alexander) drivers/gpu/drm/mxsfb/lcdif_kms.c | 33 +++++++++++-------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index 262bc43b1079..e54200a9fcb9 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -394,7 +394,7 @@ static void lcdif_crtc_mode_set_nofb(struct lcdif_drm_private *lcdif, struct drm_display_mode *m = &lcdif->crtc.state->adjusted_mode; u32 bus_flags = 0; - if (lcdif->bridge && lcdif->bridge->timings) + if (lcdif->bridge->timings) bus_flags = lcdif->bridge->timings->input_bus_flags; else if (bridge_state) bus_flags = bridge_state->input_bus_cfg.flags; @@ -463,30 +463,21 @@ static void lcdif_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_display_mode *m = &lcdif->crtc.state->adjusted_mode; struct drm_bridge_state *bridge_state = NULL; struct drm_device *drm = lcdif->drm; - u32 bus_format = 0; + u32 bus_format; dma_addr_t paddr; - /* If there is a bridge attached to the LCDIF, use its bus format */ - if (lcdif->bridge) { - bridge_state = - drm_atomic_get_new_bridge_state(state, - lcdif->bridge); - if (!bridge_state) - bus_format = MEDIA_BUS_FMT_FIXED; - else - bus_format = bridge_state->input_bus_cfg.format; - - if (bus_format == MEDIA_BUS_FMT_FIXED) { - dev_warn_once(drm->dev, - "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n" - "Please fix bridge driver by handling atomic_get_input_bus_fmts.\n"); - bus_format = MEDIA_BUS_FMT_RGB888_1X24; - } - } + bridge_state = drm_atomic_get_new_bridge_state(state, lcdif->bridge); + if (!bridge_state) + bus_format = MEDIA_BUS_FMT_FIXED; + else + bus_format = bridge_state->input_bus_cfg.format; - /* If all else fails, default to RGB888_1X24 */ - if (!bus_format) + if (bus_format == MEDIA_BUS_FMT_FIXED) { + dev_warn_once(drm->dev, + "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n" + "Please fix bridge driver by handling atomic_get_input_bus_fmts.\n"); bus_format = MEDIA_BUS_FMT_RGB888_1X24; + } clk_set_rate(lcdif->clk, m->crtc_clock * 1000);