Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7602680pxb; Thu, 18 Feb 2021 14:51:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmyDXwm1IQCqxRBzRwHZYU41ILFk2hOi11E0sV2tgGs1PmPmBDYApjPF2WCOlBPexicwnt X-Received: by 2002:aa7:dd07:: with SMTP id i7mr1486230edv.191.1613688716714; Thu, 18 Feb 2021 14:51:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613688716; cv=none; d=google.com; s=arc-20160816; b=TrLD8YnDAbZAx2beaInzf2bbT+1qk/j7BEsMZzZ/qdBfF6WECaP0dBRDZTFuF/1U4m gshIuo8IEdkmwv9CGSDq7IcMemz+5lrqyDlDMJH1aHtDDAyoSjDo2gVzCFkHjfvYKZqG GWS1wMYUH9RxSdjky4PmwRYJ9JY2zX1BPQKsDbDux/b8wIptdeihmH+6QVeXmHqIZbrv TUejGXzZYv1QLn1rKb0h1WYNwaTPpn8gtE/GiGg4KWA6opyR0XOhTU/N9YTVFna5Z+49 dIhNrhHPIjFRbqgYikYkmTNiFrNMhIgWe6DiUOPnckVphKPiC5+Zf237osECrs6H0v1f z66g== 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=mInzlqT7o9Jafk7KqwZ362owPxYNfNT21t3JuVV4T+E=; b=mgYpQcBlhCxv7ZD3qv1Blz2u0sWzb73zC/ZkH3isxBnjeQKvcULt9KP/w3U11blafd uNqyGILRECIvz5X+WNN5F5F3BQsCwjcOR3NL7W7hdU7rtiDN/dMoj4fDYZwn0uQLZOJD QCPl9ZISz4ZdJVzQUSGf9berLWK89zEma8Eugb4QlULP1wgVCEfYuNZrN5cw8+FKE5qb kGVAV5mWmtbv3/i48rh339RNsxB8MBPt8qOxQzHyQDfLCOEi6puMhBOCJ75msbYTmATo sbP/2vBFp90FNs24ylPUNRsJDOJ6Zl26/ptuW3AObtBZxCORmLCfI8Aw073JvTMkS8WY W3IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qf72mZ0i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ck22si4520735ejb.657.2021.02.18.14.51.33; Thu, 18 Feb 2021 14:51:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qf72mZ0i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229802AbhBRWt6 (ORCPT + 99 others); Thu, 18 Feb 2021 17:49:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:48708 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbhBRWtr (ORCPT ); Thu, 18 Feb 2021 17:49:47 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 82CD164DFD; Thu, 18 Feb 2021 22:49:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613688545; bh=SGNPeiZEIHSwqt1VUZYZ9K9idlNdJU7dXBV+/C03bbc=; h=From:To:Cc:Subject:Date:From; b=qf72mZ0ibMde6JSaiwo3z9u0PSmey7GqBjkO/kHW63QNTDh5qTnC+v3pZM2cK8m53 kci+DlNpoQSBrLdL9n+ve0IIHyu75/z4/3RDexTH0x6qtfCCACtJaV05iEd/Puw+LJ 9JY6MSC2ke9p2aMSKoHNW6x3GJ7DWeakB3dZGBMk5eRbRqbqMIbYOMCuJdTLMZZHps +0kznePsP6inGcIO3y5s91gwIN9qnTyATqgCf/mMdWquxETo2RNlYOnY8gPgaJASSi boUX1t/+bTKj+pUBP3WNRdCxoGfudBGGt//XgihjphTVawJmKjRSEVhja34s0KlH8Y Jn+gBttahZe+A== From: Nathan Chancellor To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= Cc: Nick Desaulniers , Kevin Wang , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor Subject: [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics Date: Thu, 18 Feb 2021 15:48:50 -0700 Message-Id: <20210218224849.5591-1-nathan@kernel.org> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clang warns: drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning: variable 'structure_size' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized] default: ^~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note: uninitialized use occurs here memset(header, 0xFF, structure_size); ^~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note: initialize the variable 'structure_size' to silence this warning uint16_t structure_size; ^ = 0 1 warning generated. Return in the default case, as the size of the header will not be known. Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics function") Link: https://github.com/ClangBuiltLinux/linux/issues/1304 Signed-off-by: Nathan Chancellor --- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c index bb620fdd4cd2..bcedd4d92e35 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c @@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev) structure_size = sizeof(struct gpu_metrics_v2_0); break; default: - break; + return; } #undef METRICS_VERSION -- 2.30.1