Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1616402ybv; Fri, 21 Feb 2020 00:21:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxnwcxUwS+XIhAxjbV8NCalMll1RvgzPwKNuXIWLRlWVKyBuGbra72qQ3kF0/Rk5kWcB7xZ X-Received: by 2002:a05:6830:2361:: with SMTP id r1mr25972339oth.88.1582273280871; Fri, 21 Feb 2020 00:21:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582273280; cv=none; d=google.com; s=arc-20160816; b=PEs9o6Nni60Wu5XUniCFC5Pp++NBQOHxmEUEhWqN+cicrkYjLKbwKVIdvIu4LjNc1f RhmN4+5B72TBRHGOEdZ3Kqw45eyFxVJU5Cu/gXRtpAYqQpQfzWaVS+i31JYkdK9H6Ajp aAVryRRTD5p5lmXpXIVs9JsvnosVxMLlbsprautTbA/M5uCiJvA8nNovT2X14gKE+sjS a31qPPvXG7tnEu2DtYiyxqjEjX+9MkszqU8/6EhpER+USBDVkgRi85jh8LDIFpG3ufHF wqmBzcOsclks3LEZa2E06TDzgmx+qbCY2VHl/r14jMG3O+A3uXmwGGn5kTDdLE1dbcnu arUg== 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=Mqtyek8JqC908m32njpNUnSpSld4wPHBam3cPhf6c0k=; b=wGTvdW/W9GXBmtl0VCWPe6m3pSocmylTk2mztAYg7vBDVVq9qLz9ZjpOEtw949hGZb gPIrf1ywuWoR8SxTAcGIyX4mCkgXJ+wBav8tnDZOuQJkk/9Ouy9CYmwK2QdOtHOM/DmC KjO86poNZ4AF15gJDFoSVWOSYoUDlyf8p7fi87wygMgrU9kQhprYjxYXhm1SgipZdRlJ XGZsTDNbmu5a3tQLMunEnkZook06nxDDT6eEAy0/ubnW2/V5TzBkbv/Yu2jmGKN7RPU9 mEBFD2fj1uPRaQTa1hR2lnAjGxqwszBCzCtSZPd88n2UUcn5ZbHiPe4aaNYsE4sBO82O DdNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LSQfuFT7; 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 z1si1128714otq.21.2020.02.21.00.21.08; Fri, 21 Feb 2020 00:21:20 -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=LSQfuFT7; 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 S2388154AbgBUIUY (ORCPT + 99 others); Fri, 21 Feb 2020 03:20:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:59384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388149AbgBUIUV (ORCPT ); Fri, 21 Feb 2020 03:20:21 -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 7BD842469C; Fri, 21 Feb 2020 08:20:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582273220; bh=XNwq0QLlDTS4aJv4GOXW4EIpQJjK7bYt4UOINmSr7Fk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LSQfuFT70ofyJHeffL2JFXGSGodrGEICXrdLx7iOI2ydFUMVyVta2usHLCTwo4IQb AU+KyJbjBFh3eDakHr8kIt1qzBpmxQjNtss68LBGFbhKrfrVunRuWJakWB5PqR1bi2 Cr8Y6438ffO3snu+6wlC0WCteBy4wyqUZCXhXB6g= 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 4.19 052/191] drm/amdgpu: Ensure ret is always initialized when using SOC15_WAIT_ON_RREG Date: Fri, 21 Feb 2020 08:40:25 +0100 Message-Id: <20200221072257.823846222@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072250.732482588@linuxfoundation.org> References: <20200221072250.732482588@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 0942f492d2e19..9d444f7fdfcdd 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15_common.h +++ b/drivers/gpu/drm/amd/amdgpu/soc15_common.h @@ -51,6 +51,7 @@ do { \ 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)) { \ udelay(2); \ tmp_ = RREG32(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg); \ -- 2.20.1