Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1639318ybv; Fri, 21 Feb 2020 00:48:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzjXpJPeVksgplzsgQMuOh49JGFfwjivMdxgb1Ou2PDfDCIidDwcQfMubeqLjXF17dfD2ZR X-Received: by 2002:a05:6808:aba:: with SMTP id r26mr1063519oij.4.1582274908691; Fri, 21 Feb 2020 00:48:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582274908; cv=none; d=google.com; s=arc-20160816; b=zvxwpyZ8+EEVZdwJqPYvEeEtFmPXIKRjJecinZTNWR3dqwLNAOfJRctsjIW85bv9pd zegAkeblfPbVVw1KF2l4ZKY9LM60oCApfuMMXD0NfuEStKjO3jAED8WO+ICMbfaLdT++ MKdaawQ4FuYDbbencdKsQRRGvkQc8xRMVa1cm15jAIh0fSVzYpyMkUKL85rUdHyxMwSe zo0+1O1DJWr3rMgG6V3Y05JJ5SieW5r/pKAAeSP6Ujd1lv0hpF+odVZziR9BDQWUDh64 6tlyx0y638sQhk7zf8X6kJcXexMC1Diz1G5c1iww6y9lPTmcSm/eeoUa5Az9U7vEiier DslQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wyLFvHthmbP3L6cx7Yu6kcCTofsKg3MBizphFrfuopk=; b=I10rlk3RFjvhJMP8JRpn0eH2F4WgPNZ2TQLJaRkkI6AS+ISCNLABMNMvkoHvRNTqnB /MNS6g+NYeWEwX6zHIqKqLqiN6AEmZgGPArocb6WYgy2TgnAA7gASUXZck0l5OOCBrp/ N4DdrFtUdLXyGX8AbOAFAX5I5ynzkD7KzVsmX42WCWkEuIUYd+3gyW6FrJk0LiGB+qHX s5c5/uB6pAhKQse0XdwGYIFuWFGRL0hgegxyyuw5RP1M6zNIZQdF8OfG98zJKD4aILXU FaSz7jR31zm9wJFDeCbjrvP3I6O194ApzTwT4iT3XPAl7hjP+lsZJYmCa/98AM3ZN94C koaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bE5vg+lV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t130si452662oib.202.2020.02.21.00.48.16; Fri, 21 Feb 2020 00:48:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bE5vg+lV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728728AbgBUHsL (ORCPT + 99 others); Fri, 21 Feb 2020 02:48:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:44130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728420AbgBUHsJ (ORCPT ); Fri, 21 Feb 2020 02:48:09 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 76482207FD; Fri, 21 Feb 2020 07:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582271288; bh=X/Dq+PeQjECF1L6QQ6O2t+J7BdtB35HFF99zLyDSSpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bE5vg+lVaqQO/xHpII9FSib8gcdeUa9w4E931TSrqGu7SSTeleN2I+uHckMQWCnIn s2MZoLMbNKB0j3bupr0tk/vO0YuEnh/V2MUBMzIHC1K8mgELxRPo4hAf/jrebCLLek 93m/CD2goUxqP34xWhiIRGnCpdCb7NmahO2FFE9M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Alex Deucher , Sasha Levin Subject: [PATCH 5.5 108/399] drm/amdgpu: Ensure ret is always initialized when using SOC15_WAIT_ON_RREG Date: Fri, 21 Feb 2020 08:37:13 +0100 Message-Id: <20200221072412.929625036@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072402.315346745@linuxfoundation.org> References: <20200221072402.315346745@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor [ Upstream commit a63141e31764f8daf3f29e8e2d450dcf9199d1c8 ] Commit b0f3cd3191cd ("drm/amdgpu: remove unnecessary JPEG2.0 code from VCN2.0") introduced a new clang warning in the vcn_v2_0_stop function: ../drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1082:2: warning: variable 'r' is used uninitialized whenever 'while' loop exits because its condition is false [-Wsometimes-uninitialized] SOC15_WAIT_ON_RREG(VCN, 0, mmUVD_STATUS, UVD_STATUS__IDLE, 0x7, r); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../drivers/gpu/drm/amd/amdgpu/../amdgpu/soc15_common.h:55:10: note: expanded from macro 'SOC15_WAIT_ON_RREG' while ((tmp_ & (mask)) != (expected_value)) { \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1083:6: note: uninitialized use occurs here if (r) ^ ../drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1082:2: note: remove the condition if it is always true SOC15_WAIT_ON_RREG(VCN, 0, mmUVD_STATUS, UVD_STATUS__IDLE, 0x7, r); ^ ../drivers/gpu/drm/amd/amdgpu/../amdgpu/soc15_common.h:55:10: note: expanded from macro 'SOC15_WAIT_ON_RREG' while ((tmp_ & (mask)) != (expected_value)) { \ ^ ../drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1072:7: note: initialize the variable 'r' to silence this warning int r; ^ = 0 1 warning generated. To prevent warnings like this from happening in the future, make the SOC15_WAIT_ON_RREG macro initialize its ret variable before the while loop that can time out. This macro's return value is always checked so it should set ret in both the success and fail path. Link: https://github.com/ClangBuiltLinux/linux/issues/776 Signed-off-by: Nathan Chancellor Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/soc15_common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/soc15_common.h b/drivers/gpu/drm/amd/amdgpu/soc15_common.h index 839f186e1182a..19e870c798967 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15_common.h +++ b/drivers/gpu/drm/amd/amdgpu/soc15_common.h @@ -52,6 +52,7 @@ uint32_t old_ = 0; \ uint32_t tmp_ = RREG32(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg); \ uint32_t loop = adev->usec_timeout; \ + ret = 0; \ while ((tmp_ & (mask)) != (expected_value)) { \ if (old_ != tmp_) { \ loop = adev->usec_timeout; \ -- 2.20.1