Message ID | 20190704055217.45860-5-natechancellor@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <dri-devel-bounces@lists.freedesktop.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 00880138B for <patchwork-dri-devel@patchwork.kernel.org>; Thu, 4 Jul 2019 07:26:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFA5328A1D for <patchwork-dri-devel@patchwork.kernel.org>; Thu, 4 Jul 2019 07:26:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D437128A34; Thu, 4 Jul 2019 07:26:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 92F3D28A1D for <patchwork-dri-devel@patchwork.kernel.org>; Thu, 4 Jul 2019 07:26:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E593C6E2B1; Thu, 4 Jul 2019 07:25:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 279B66E25B; Thu, 4 Jul 2019 05:52:54 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id d4so4212874edr.13; Wed, 03 Jul 2019 22:52:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sk7x/uIvEdvnOhCPEBQK8xnGMTAhDlc8g18Tgsd50+s=; b=Y9PA3Kakn8FWLahgyX71ojV7LYUe3/YWPg3avP7CZ7nWzRoLTk4AjgCmWNU5Fgq1lJ 68qxY1l53bHz9ZwlotW2esLX0Zqigy9Vdzgr9pNZ6SFFO66PHTSjyi62KJRSIuvQ1v3d hRS8eYyadqkAKyREapX0AUmikSQh/Jed7pneBp4RQx7vp9Zd5T+ZDRQGphc1TXWF8My0 a3sByCdEpA4CSgxol2qI+xs1XSxDSlHDx8JnoONU7WMvyHUh0nmuJfe/QGRlFqYoJ6LK gYVgJqQlVXAqb3WROBm/e1nqPM/f/ac2ruRaKucMiajRJjaA1BAUVw6Lv2f2zji3yFYa Huig== X-Gm-Message-State: APjAAAWOsV1r1NvesAqoBSCVBYW/1sZfsJ8tv8Q9MqDczM3LCiDktA3o QFixbmwDdInE+OEN3RptZuI= X-Google-Smtp-Source: APXvYqwCKPS2hEek618wWEP0KFmsaYwMHuJ0lWVI6Mz4KIFr5ilCUyX+l2b0RP8EIu445RFt+d9oKw== X-Received: by 2002:a17:906:edd7:: with SMTP id sb23mr28250772ejb.309.1562219572730; Wed, 03 Jul 2019 22:52:52 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f9:2b:2b15::2]) by smtp.gmail.com with ESMTPSA id j30sm1343532edb.8.2019.07.03.22.52.51 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 03 Jul 2019 22:52:52 -0700 (PDT) From: Nathan Chancellor <natechancellor@gmail.com> To: Alex Deucher <alexander.deucher@amd.com>, =?utf-8?q?Christian_K=C3=B6nig?= <christian.koenig@amd.com>, "David (ChunMing) Zhou" <David1.Zhou@amd.com>, Harry Wentland <harry.wentland@amd.com>, Leo Li <sunpeng.li@amd.com>, Rex Zhu <rex.zhu@amd.com>, Evan Quan <evan.quan@amd.com> Subject: [PATCH 4/7] drm/amd/powerplay: Zero initialize freq in smu_v11_0_get_current_clk_freq Date: Wed, 3 Jul 2019 22:52:15 -0700 Message-Id: <20190704055217.45860-5-natechancellor@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190704055217.45860-1-natechancellor@gmail.com> References: <20190704055217.45860-1-natechancellor@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 04 Jul 2019 07:25:13 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sk7x/uIvEdvnOhCPEBQK8xnGMTAhDlc8g18Tgsd50+s=; b=X31O77djkxsK14FGB/XNRtzgI/6Xi8+vcGgZzqR51BVRF9R51PjC4m7RTkRWKcpRVq oPNOSfHC1eU7T7y0WBDld+PMP6AJtu7YVdUufwqCvWNVJiQzSh82vqi8FwY6nr4ACp6i 0MBcMyaocwVoW5Hl2mINO8yaxMGY3K/+XDt7GyXma1BG7pLVDvHvAjQeSX3FvSXBIWVZ RQX28ykaX5qfvfFJTYtHXVUD5etlX5vXudvbKTqeIxYUhDpfHDsjUwuF6tzv4m2MQvvI RzNt6/5acyN/+BA+HP+S43FWgIJYFUGFJNZxkjfCcoWKbu+ID32EBPX6qhOQWudpIosv kzCw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> Cc: David Airlie <airlied@linux.ie>, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, clang-built-linux@googlegroups.com, amd-gfx@lists.freedesktop.org, Nathan Chancellor <natechancellor@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
amdgpu clang warning fixes on next-20190703
|
expand
|
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c index 632a20587c8b..a6f8cd6df7f1 100644 --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c @@ -1088,7 +1088,7 @@ static int smu_v11_0_get_current_clk_freq(struct smu_context *smu, uint32_t *value) { int ret = 0; - uint32_t freq; + uint32_t freq = 0; if (clk_id >= SMU_CLK_COUNT || !value) return -EINVAL;
clang warns (trimmed for brevity): drivers/gpu/drm/amd/amdgpu/../powerplay/smu_v11_0.c:1098:10: warning: variable 'freq' is used uninitialized whenever '?:' condition is false [-Wsometimes-uninitialized] ret = smu_get_current_clk_freq_by_table(smu, clk_id, &freq); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If get_current_clk_freq_by_table is ever NULL, freq will fail to be properly initialized. Zero initialize it to avoid using uninitialized stack values. smu_get_current_clk_freq_by_table expands to a ternary operator conditional on smu->funcs->get_current_clk_freq_by_table being not NULL. When this is false, freq will be uninitialized. Zero initialize freq to avoid using random stack values if that ever happens. Fixes: e36182490dec ("drm/amd/powerplay: fix dpm freq unit error (10KHz -> Mhz)") Link: https://github.com/ClangBuiltLinux/linux/issues/585 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> --- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)