From patchwork Thu Mar 16 13:23:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 70791 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp487051wrt; Thu, 16 Mar 2023 06:38:03 -0700 (PDT) X-Google-Smtp-Source: AK7set/L2+u1N5K3FJHniP+gMZ8Evw4/ZvHwvGey37R+ajpVAarP0QPqWuoKJRdI44zZzUFZaZj2 X-Received: by 2002:a17:90b:4a07:b0:234:1d1d:6ae6 with SMTP id kk7-20020a17090b4a0700b002341d1d6ae6mr4081563pjb.1.1678973882912; Thu, 16 Mar 2023 06:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678973882; cv=none; d=google.com; s=arc-20160816; b=j9bCIszgGOFxzglDTuVSd0m7tRwfVXmmV+Uh4Uo28PvBDS3evzc4yeF9PygCu0sde/ csiVKHOOsBlrYIFjsIe5rr9GIxTCQ5Ef/MEjPSvxSFy8PVLrLxzanLVLjc3T8xhNW56D 6YtE5c0dlOMKaBOWld/5uM5ItwvcGaDKXCy87TUqy24aYfxpdnQPWdFfiZXFyoYw8PJW fmFivsZzs8luIQ19p+ErMn3BnewnkTShKF2UUPUVmHtuz84EnEGATUUXzjziNFMdn4jK YnYs+k4/6UM9JztUgzWQhxeU2mAMa6W19rjfvhjdQYFNFElAzka1b+QlIPlX8YBoEWwa j1jA== 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=lOSbCq91ofT9YXvZbpEo/wG2mXE51QVka7uRfgSRss4=; b=QqDsMuH0JscKuSA1U3ixSbkKEtb/BeG3aoTrtw+FYBqBfNZOAnRsjd+OkbvbekZjVA wALXQvP9z1DMooJKEr+pilPwG9NP8049k94VOEqjUmPpbPn1QkwZV+QH3YbAwm38zZ6x VL4LYIok+ovC4kEdixKAU1DtziKUwy3jBQit9yyd+KqoQ0nS66q5arZltFfc9aynDgx/ zjSEwBWmoCNN06czP8ztpBrmBZxmB40IaKaPGdgWq7FYBUfDpP3DZFcV9BU6LiSi29bR FC3ABz+WqBFDVHeA47J3FB/plCf8/15wAueOltYueq8Kcqf1vP5xGef67bY/Wy3RXO3X WS3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IVwhfbkc; 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=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q25-20020a637519000000b0050bfc85d989si516703pgc.154.2023.03.16.06.37.48; Thu, 16 Mar 2023 06:38:02 -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=@redhat.com header.s=mimecast20190719 header.b=IVwhfbkc; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230234AbjCPNX6 (ORCPT + 99 others); Thu, 16 Mar 2023 09:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbjCPNX5 (ORCPT ); Thu, 16 Mar 2023 09:23:57 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAAD81E5D8 for ; Thu, 16 Mar 2023 06:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678972989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=lOSbCq91ofT9YXvZbpEo/wG2mXE51QVka7uRfgSRss4=; b=IVwhfbkcCEMj2i2GxxK0WVJywawaLZuGT9bGYGgxq33rnxlGYgT54ZY6msoeI3US5WdDgX MaG+c45/XoUxLGFbhuHTuHmoSPkXMptR070Hxk11Iw/mFm0XW9hJWnSc2jQ1Rs5KgjpCK4 Vh1GXviH5SgX5UjZUIRHn/0RPDX7+Ag= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-657-qv-HNiXFNYe0Q9iudK98XA-1; Thu, 16 Mar 2023 09:23:08 -0400 X-MC-Unique: qv-HNiXFNYe0Q9iudK98XA-1 Received: by mail-qv1-f69.google.com with SMTP id r4-20020ad44044000000b005ad0ce58902so1043607qvp.5 for ; Thu, 16 Mar 2023 06:23:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678972988; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lOSbCq91ofT9YXvZbpEo/wG2mXE51QVka7uRfgSRss4=; b=Du6UAgkkd4x1ZzAwOZ8FKY7tFSDmMR1Gg8s2IXzCxOQh5gIxlIVM4D/ByMMuQ2w3GF HekllHFIQOTAe+ZQw+TynDCFrQRShdS9F1RzfwU00JXOUj/PF7x8FtlNf93L8aoGYuJ8 zg+wjSDBIaRmx44mpE4B3cOSGfswkXLDJFn2jRK9DIuxm+YOb4gPzFqq/3rBU9xmv8EL mRcf79BYPOgwPj06g8Dg0K50D8MHrBJqq4t3Y8etAPzsbHJcsy9dv6arQATE6Gb28v2P R5hIOlsrYOfc7j07na8fwAoDTWvW7eBRVl8FP20woL2UmLD9voMPju3KQknBKTXuqZKv XZKg== X-Gm-Message-State: AO0yUKWUvkcdaviTTReDf4Dxy6hrZUEtLAYmLnvLV8bYpcPM8jtFOvE0 ujC0PmWMY29RSfX9ILP5y8HCr04GBOhK5nYj9q8hb590lekfA+l3epd+nWx8Zagt+ZZQfxuDQMf Xg4GW7xzkveaSeLse6g5ORgnw X-Received: by 2002:ad4:5aee:0:b0:56e:ab08:670d with SMTP id c14-20020ad45aee000000b0056eab08670dmr32716489qvh.42.1678972988195; Thu, 16 Mar 2023 06:23:08 -0700 (PDT) X-Received: by 2002:ad4:5aee:0:b0:56e:ab08:670d with SMTP id c14-20020ad45aee000000b0056eab08670dmr32716450qvh.42.1678972987917; Thu, 16 Mar 2023 06:23:07 -0700 (PDT) Received: from dell-per740-01.7a2m.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id g187-20020a37b6c4000000b00743592b4745sm5803599qkf.109.2023.03.16.06.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 06:23:07 -0700 (PDT) From: Tom Rix To: hjc@rock-chips.com, heiko@sntech.de, airlied@gmail.com, daniel@ffwll.ch, nathan@kernel.org, ndesaulniers@google.com, michael.riesch@wolfvision.net, s.hauer@pengutronix.de Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Tom Rix Subject: [PATCH] drm/rockchip: vop2: fix uninitialized variable possible_crtcs Date: Thu, 16 Mar 2023 09:23:02 -0400 Message-Id: <20230316132302.531724-1-trix@redhat.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760531718389512263?= X-GMAIL-MSGID: =?utf-8?q?1760531718389512263?= clang reportes this error drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2322: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:2336:36: note: uninitialized use occurs here ret = vop2_plane_init(vop2, win, possible_crtcs); ^~~~~~~~~~~~~~ drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2322:4: note: remove the 'if' if its condition is always true if (vp) { ^~~~~~~~ The else-statement changes the win->type to OVERLAY without setting the possible_crtcs variable. Rework the block, initialize possible_crtcs to 0 to remove the else-statement. Split the else-if-statement out to its own if-statement so the OVERLAY check will catch when the win-type has been changed. Fixes: 368419a2d429 ("drm/rockchip: vop2: initialize possible_crtcs properly") Signed-off-by: Tom Rix Acked-by: Michael Riesch Reviewed-by: Nathan Chancellor --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 03ca32cd2050..fce992c3506f 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -2301,7 +2301,7 @@ static int vop2_create_crtcs(struct vop2 *vop2) nvp = 0; for (i = 0; i < vop2->registered_num_wins; i++) { struct vop2_win *win = &vop2->win[i]; - u32 possible_crtcs; + u32 possible_crtcs = 0; if (vop2->data->soc_id == 3566) { /* @@ -2327,12 +2327,11 @@ static int vop2_create_crtcs(struct vop2 *vop2) /* change the unused primary window to overlay window */ win->type = DRM_PLANE_TYPE_OVERLAY; } - } else if (win->type == DRM_PLANE_TYPE_OVERLAY) { - possible_crtcs = (1 << nvps) - 1; - } else { - possible_crtcs = 0; } + if (win->type == DRM_PLANE_TYPE_OVERLAY) + possible_crtcs = (1 << nvps) - 1; + ret = vop2_plane_init(vop2, win, possible_crtcs); if (ret) { drm_err(vop2->drm, "failed to init plane %s: %d\n",