Message ID | 20230124054706.3921383-2-michael.riesch@wolfvision.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1985197wrn; Mon, 23 Jan 2023 21:51:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXv33xWU59NLNm4wAGxqcodvjCc6MNTPb8jCOVPZRH8+POFWAC222t/HFyniEZCHAwcLxvOX X-Received: by 2002:a05:6a00:1d8d:b0:580:cc63:dcdc with SMTP id z13-20020a056a001d8d00b00580cc63dcdcmr27639473pfw.7.1674539507590; Mon, 23 Jan 2023 21:51:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674539507; cv=pass; d=google.com; s=arc-20160816; b=BpNP2oSNvCoM7FEREpTqNIOncxKWU+JEsJsEOx/HsekkhMhYpWqsrhn6MBv3OkhjSO 0uYmhJ5GISgahj0uoniC7vxre+h74NKnOIt9W3u4Om7tz0YzULHZ7wxxqIEJVXj0EEBv 2aM2URdljDShOaIKHsPy1lg3Zk9zGz++r8KbTWYRwCWIO5pnMSCWWYpKy9HF0TewwUYX kExaty7orky/okPCguNLriprtwVY2fsSPQ3vV14XztnNANqJa7m4aILHOeKZQ4+WztUk 0Rv0LuD283i4HKRQwnkcVVlLZicRny0UatZOVXu7r7VBX4xgLwLLdgFbEYJ1CkweqVqg dX2g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UGIuKWsYCciICpr9vBMDMPjsBMY2adEd1zx1srWGQmE=; b=E+hFrp/7avPOhDQPEmXE7mjCH3FIkqm8ALaXdv7kfJotERZjfRmNAYlHNId4YJoEX4 0K8DKgO6Soj//q941Jb8r1FdOT7F4YRpEKC7E93zS5dFRaOVpUF5o/zY8OmOtq3FPqBt SHmk7cWNNuHXkaqUceElvnTa6VZVWg1CwoPcIFwnrfVbcakYhY2PKNuB1Z8weD/2y1kO JrWvup3TSrKtzC1c0YpnkuimEgY2Fq3kwI+KjdEc716HzbcIp26Da6WT61vL7hPbUrwW vzKb4EP+6XjW8+DHmUmv1k69uclHHwhhbpKEo+uCtDFuc2jUz4GcFWvtZp+vAtkkgdAu dr0A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=fJpLusx7; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a056a00178d00b00580d9a62ab8si1459914pfg.184.2023.01.23.21.51.35; Mon, 23 Jan 2023 21:51:47 -0800 (PST) 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=@wolfvision.net header.s=selector2 header.b=fJpLusx7; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233025AbjAXFtS (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Tue, 24 Jan 2023 00:49:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233024AbjAXFtK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 24 Jan 2023 00:49:10 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2086.outbound.protection.outlook.com [40.107.104.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C62CE3B674; Mon, 23 Jan 2023 21:48:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b4Wodc8odM6+YtvbfO5w/jXx94+BfapnVJLoMqwD493abneEKgw0UZOQyoRdi+19pVpvVxKnZyUtJd62h4C4f9L7TP9zsILz2ImwdvQIKbv33lN4cQft/S8tbUr7zxlDo5iFt9XSjysfr+wlKyCDUCqA6Us8FwQqwgufbkXQainoM7/OJo/9/Kit9ufqaarLrD5ffLZ6v1C28JUJrkKz51kEE6VoCPVSaUsY13Ah26Lr41qBBF4/Vti8CyXAE6VQeKvQNxAv7+JiEf5p5/MmaRCbsqI9GOvTZYTh67QQY7oCpHXtjnKKTm903nRz5g8XpwN9priMs1Co3fwRUxhcqQ== 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=UGIuKWsYCciICpr9vBMDMPjsBMY2adEd1zx1srWGQmE=; b=FFQ3xeWw3Dt16DuWD4vRLuFyPuvyj6koRMRXzPKK8EhP9jv+xoxEu8FmX/2K47iIryUiDbOi9J83GoR+9JgY7ZgTVVrNbni93sgVA6/kW5UnhMJtMH72T+1B1Qu+7Yf9EUeXW/thYUDcjaNLZjET2PjgUEcZfiLNpu4yS2uSMvpAiSj8ESSva0ne0TFy3qy5gCCn6TxaOw4YoPJnsKunkUeY2/Z0ToI+O7v097jVzWC3W8EoV6G934wrQ90zMPVCSN7cGsvOB+LFSX4lvuyqMQw5UWLfYObeCtjEYnusnmxjerzOGOl9y1vcS/14LPp6aoaFkHRHCXCTLAw7n7MENQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UGIuKWsYCciICpr9vBMDMPjsBMY2adEd1zx1srWGQmE=; b=fJpLusx7Tz3nJyovUNSaAz1UEA6qSVyX+dzJoZAZJBOY3VDE4hmr6Sie3Ozei+TbJC80Ya7MdnLP5AAstbL4vMx6F9whPP7buaPUYQRPpBsA4VcrI0y4IcXuxp52LgOhmAguExXc5jO/ZBKtNZ1/8wQh3sFzu72x2I0TfZ/wZQs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) by VE1PR08MB5678.eurprd08.prod.outlook.com (2603:10a6:800:1a0::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Tue, 24 Jan 2023 05:47:18 +0000 Received: from DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::4718:6092:e763:4219]) by DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::4718:6092:e763:4219%2]) with mapi id 15.20.6002.033; Tue, 24 Jan 2023 05:47:18 +0000 From: Michael Riesch <michael.riesch@wolfvision.net> To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Heiko Stuebner <heiko@sntech.de>, Sandy Huang <hjc@rock-chips.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Sascha Hauer <sha@pengutronix.de>, Michael Riesch <michael.riesch@wolfvision.net>, kernel test robot <lkp@intel.com>, Dan Carpenter <error27@gmail.com> Subject: [PATCH v3 1/6] drm/rockchip: vop2: initialize possible_crtcs properly Date: Tue, 24 Jan 2023 06:47:01 +0100 Message-Id: <20230124054706.3921383-2-michael.riesch@wolfvision.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230124054706.3921383-1-michael.riesch@wolfvision.net> References: <20230124054706.3921383-1-michael.riesch@wolfvision.net> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: ZR0P278CA0189.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:44::6) To DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR08MB9155:EE_|VE1PR08MB5678:EE_ X-MS-Office365-Filtering-Correlation-Id: ece9baeb-56dc-4430-aeb9-08dafdce7445 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9624BrPEwu8tZkM26kX0a66E2eCWUFhOTQUeKWDLkOQmP5LNu/uvCGdRtb2UaK1GwxnrRFAjU1J3pdwBn20InfdevCnRDYLXO3iaGPUesgW5Eq9pnCt0HJiGLmvFRmAl45bp4LUVcuslc/BO4TXQJP3DKsgveQdqe3rVVTYyAduKW2WyyiqxS2cKiD0m5YvAvlawFqNTmO6UbIeQlETzNfd6tZwV7XvcrGsnyzDpkeTPG2t7v7nK6yIrzhMWCH+k1+Y4o738Q3LWCG80VEc1OA/2Kyz6QYwLgThNqNDIQ34w7nbFSoTknelTN/zNItfXclj8I7da5qDTTAjYceMDng8EP85iaKRAz7nizY11Us1d4OoekwKHMS47maOohW/zGpp2zTu2UWw4BjXV9oM969wV01J72Ox7ObYTaOBeG/Dni7hWX6LHYxfAfx/eAu8eMgW/JABqTasUMdDoHd47uUNArQwQiMftCUdgNNP/LTEB+75pqS2uCnMVcoBh6hlQzYdFlQl5GVuBRJQHAVJ+MJjN9T5/LdwLKo3ZWJZuPLXfc/UDI7gQnrKzWCG7BG59q5SANtUYKpQt3aH3HIP2hRKGDEG9G/YIj6Vnw9/eB4pa9reTvnyFj/1vNj0g4eQQSiEw6Ed0pc4DUUV8z68wyA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR08MB9155.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(39840400004)(396003)(376002)(136003)(346002)(451199015)(1076003)(66946007)(4326008)(8676002)(66476007)(6486002)(66556008)(52116002)(2616005)(6512007)(6666004)(44832011)(186003)(5660300002)(8936002)(7416002)(41300700001)(83380400001)(2906002)(6506007)(38100700002)(54906003)(316002)(86362001)(478600001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: acjmyvzDTN3cYJ3RgLbKGteX4jki4nQkRf4YyawX1ZjZ1JVM/QouPVorv3rEde2Nl92HNAQOquJg+7E3VgUaV90af4aPMt2r55geSvNce3/H7Pn4VMr/eP9vAVsNjRukeN0JkBgVllf3HpE5OkPdeHLY98SxOLmF/lnPVhPBmwmaf+WPNTPyDbFI3LahAEichaMfVLRYadSn5VxfqWO/t0XHIXdllcEfQOseZaHh+4TFIEHSWZhZMjt8wzwZvCYaVVmqCxkp53v8SWY+2KPowBQKR/UtNpSGYJfuQFqNnEC+GdH6bBa80A4tSdvCfrNqJ22VU1DcnxcifaNmh6K0W94qYolPkGQsFgkLZIBb1pMb4JKk4b8cW9PrzXEndrGoULA1VeZN9ZkFtR6RYqfqWmCTkKL8ArmJSbxBN0r0NEzZMSqusrY1NjY6lcbzNpTH1OiQvXMT5RY8pWPu5lJKNuqGtwL1lOZAIyUHqykNUyPKqBvfpJC8Iwu1gXm7g+f26jFfSqIa2zCgvxvi4V3gbyoCKLd0ZA8JSGfiJNqV9uog7KFm+ZJF9CqZ5VI2pCy/lfB9rDO9ixb0sM9wIaLGbwFcLpZ2EolXjgq0uM66FDRhfi6jWjpuS0GQFQmhaOdW1a9eCiHc6ZtX0ZX1JkWoGY9R6Xlj+dUPvGXBQuK2rDQEL3APjyvNYKJbigApMoQNPpvFXdEkDXESGgOG6heCepwfO51UvFwrBwtXIVLDDQ8AMiwqJplsV0kcdxR3clCD4YvkoT41Tk1OYvq19yEjTIVy5s6/u+mbbDYHKFD1ThAdK7KwliYS+7kEAWtb1EhWexKSyBwFbkJKDsYKgFY3pq+koYmtLYAV5IvIH5vuJ0RmlWvs65C/f231HQA8+dNNV2HkuQM0O61gnS6KF/HuWI7HlNWm09OGIdbvNMo2sx1FF478BoYC6yhfL2UaIy6Hf70U9MP3jsZ7kh9b3FMkQLofP35pQJPWviwTtOjicqcpLwWz/MksO5IbLQ4gBJVO5c97DdGfE85mOPvagCHiJc0ozrZY1rYUHXNiKIWajSPOIakZQPO5ycr2WDfknznxh30fhd9/glaQ7fzXAO2IIgSaDwBsmejfuuyDJEG86fzE4zqtSiWhziiAov91lgKrtkOilDsT7WGc2cdjio/uKfFcebFePGPHEu/dtIVXMpAdS7Sjrd0OBH5GFLUUOpt7KCf3oTZ5KrqrieBYpaVEJkr50VbyOlytR0Zp7nkBhhjiAFafaAFETxyzS+pprFYKxcV+gsvN1xZVxVLX0GshQJuILRKHM7ZfayZ3QkPC6Y5h4W/KlsAJbPNiym35/lx9WYWTp49T8dKNxqZwCdbhBvAK4teGMhRW75tqhp0XgtE0j2WbC+akHEcE4LarvnaDyAG/QHga90jSmzTfmul1pca03hBTGC7bgh1XhauFM93aw8+OWvPuAF1U7Y1svsgALiZaAIeqKkMJJknpsTd97pmq/478K6bL1H6N9b3KuoKRqWlOllw5fcj6Fzmn/3RK1aO7GNOO1WvjnNxkyzyPPHP5ilvzWVeWN7ELJ1v5ll27KutLX0qYZg59i6aPMKzAEkENH4Di/tSkEgUyF/jtZOMpmn1au4Y+pTTFM2Hqicn6nR4v3NYdCaNaL7kRFP6B6kA5TJ0NX7qA65gsmChp7kWpGGFTh3MiYldh4sSjaZg= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: ece9baeb-56dc-4430-aeb9-08dafdce7445 X-MS-Exchange-CrossTenant-AuthSource: DU0PR08MB9155.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 05:47:18.3879 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uxsKFkoADZBILnwX0zHPUt9Wn9VE9tr83pbkSTrKEn0YEHdODlQnMFtbi0lYUqtfpKLtsiAFfOEcF+jbAF9fWj8rtVk5rR8II+ZIOF3G+XI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5678 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755881938437774190?= X-GMAIL-MSGID: =?utf-8?q?1755881938437774190?= |
Series |
drm/rockchip: vop2: add support for the rgb output block
|
|
Commit Message
Michael Riesch
Jan. 24, 2023, 5:47 a.m. UTC
The variable possible_crtcs is only initialized for primary and
overlay planes. Since the VOP2 driver only supports these plane
types at the moment, the current code is safe. However, in order
to provide a future-proof solution, fix the initialization of
the variable.
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
v3:
- no changes
v2:
- new patch
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Comments
Hi Michael, On Tue, Jan 24, 2023 at 06:47:01AM +0100, Michael Riesch wrote: > The variable possible_crtcs is only initialized for primary and > overlay planes. Since the VOP2 driver only supports these plane > types at the moment, the current code is safe. However, in order > to provide a future-proof solution, fix the initialization of > the variable. > > Reported-by: kernel test robot <lkp@intel.com> > Reported-by: Dan Carpenter <error27@gmail.com> > Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net> > --- > v3: > - no changes > v2: > - new patch > > drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c > index 8cecf81a5ae0..374ef821b453 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c > @@ -2322,10 +2322,11 @@ static int vop2_create_crtc(struct vop2 *vop2) > /* change the unused primary window to overlay window */ > win->type = DRM_PLANE_TYPE_OVERLAY; > } > - } > - > - if (win->type == DRM_PLANE_TYPE_OVERLAY) > + } else if (win->type == DRM_PLANE_TYPE_OVERLAY) { > possible_crtcs = (1 << nvps) - 1; > + } else { > + possible_crtcs = 0; > + } > > ret = vop2_plane_init(vop2, win, possible_crtcs); > if (ret) { > -- > 2.30.2 > This patch is now in -next as commit 368419a2d429 ("drm/rockchip: vop2: initialize possible_crtcs properly") and it actually appears to introduce a path where possible_crtcs could be used uninitialized. drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2316:8: error: variable 'possible_crtcs' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (vp) { ^~ drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2330:36: note: uninitialized use occurs here ret = vop2_plane_init(vop2, win, possible_crtcs); ^~~~~~~~~~~~~~ drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2316:4: note: remove the 'if' if its condition is always true if (vp) { ^~~~~~~~ drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2298:21: note: initialize the variable 'possible_crtcs' to silence this warning u32 possible_crtcs; ^ = 0 1 error generated. Prior to this change, if that else path was hit, clang recognized based on the assignment that the next if statement would always be true. Now, if the else path is taken, the possible_crtcs assignment will be missed. Is that intentional? Cheers, Nathan
Hi Nathan, On 3/14/23 17:08, Nathan Chancellor wrote: > Hi Michael, > > On Tue, Jan 24, 2023 at 06:47:01AM +0100, Michael Riesch wrote: >> The variable possible_crtcs is only initialized for primary and >> overlay planes. Since the VOP2 driver only supports these plane >> types at the moment, the current code is safe. However, in order >> to provide a future-proof solution, fix the initialization of >> the variable. >> >> Reported-by: kernel test robot <lkp@intel.com> >> Reported-by: Dan Carpenter <error27@gmail.com> >> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net> >> --- >> v3: >> - no changes >> v2: >> - new patch >> >> drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 7 ++++--- >> 1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c >> index 8cecf81a5ae0..374ef821b453 100644 >> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c >> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c >> @@ -2322,10 +2322,11 @@ static int vop2_create_crtc(struct vop2 *vop2) >> /* change the unused primary window to overlay window */ >> win->type = DRM_PLANE_TYPE_OVERLAY; >> } >> - } >> - >> - if (win->type == DRM_PLANE_TYPE_OVERLAY) >> + } else if (win->type == DRM_PLANE_TYPE_OVERLAY) { >> possible_crtcs = (1 << nvps) - 1; >> + } else { >> + possible_crtcs = 0; >> + } >> >> ret = vop2_plane_init(vop2, win, possible_crtcs); >> if (ret) { >> -- >> 2.30.2 >> > > This patch is now in -next as commit 368419a2d429 ("drm/rockchip: vop2: > initialize possible_crtcs properly") and it actually appears to > introduce a path where possible_crtcs could be used uninitialized. > > drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2316:8: error: variable 'possible_crtcs' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] > if (vp) { > ^~ > drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2330:36: note: uninitialized use occurs here > ret = vop2_plane_init(vop2, win, possible_crtcs); > ^~~~~~~~~~~~~~ > drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2316:4: note: remove the 'if' if its condition is always true > if (vp) { > ^~~~~~~~ > drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2298:21: note: initialize the variable 'possible_crtcs' to silence this warning > u32 possible_crtcs; > ^ > = 0 > 1 error generated. > > Prior to this change, if that else path was hit, clang recognized based on > the assignment that the next if statement would always be true. Now, if > the else path is taken, the possible_crtcs assignment will be missed. Is > that intentional? As it turns out, the approach in my patch does not cover all paths. I'll submit a follow-up patch that initializes possible_crtcs = 0 and drops the else path. This should solve the issue for good. Regards, Michael
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 8cecf81a5ae0..374ef821b453 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -2322,10 +2322,11 @@ static int vop2_create_crtc(struct vop2 *vop2) /* change the unused primary window to overlay window */ win->type = DRM_PLANE_TYPE_OVERLAY; } - } - - if (win->type == DRM_PLANE_TYPE_OVERLAY) + } else if (win->type == DRM_PLANE_TYPE_OVERLAY) { possible_crtcs = (1 << nvps) - 1; + } else { + possible_crtcs = 0; + } ret = vop2_plane_init(vop2, win, possible_crtcs); if (ret) {