mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Alex Deucher <alexander.deucher@amd.com>
Cc: "Arnd Bergmann" <arnd@arndb.de>,
	"Christian König" <christian.koenig@amd.com>,
	"David Airlie" <airlied@linux.ie>, "Rex Zhu" <Rex.Zhu@amd.com>,
	"Eric Huang" <JinHuiEric.Huang@amd.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drm/amd/powerplay: fix integer overflow warning
Date: Mon,  4 Jul 2016 15:18:06 +0200	[thread overview]
Message-ID: <20160704131849.1102843-1-arnd@arndb.de> (raw)

A late bugfix for v4.7 introduced a build-time regression, producing
a (probably harmless) warning:

powerplay/hwmgr/polaris10_hwmgr.c: In function 'polaris10_populate_clock_stretcher_data_table':
powerplay/hwmgr/polaris10_hwmgr.c:1817:4: error: this decimal constant is unsigned only in ISO C90 [-Werror]
    volt_without_cks = (uint32_t)((2753594000 + (sclk_table->entries[i].clk/100) * 136418 -(ro - 70) * 1000000) / \
    ^~~~~~~~~~~~~~~~
powerplay/hwmgr/polaris10_hwmgr.c:1822:4: error: this decimal constant is unsigned only in ISO C90 [-Werror]
    volt_without_cks = (uint32_t)((2416794800 + (sclk_table->entries[i].clk/100) * 1476925/10 -(ro - 50) * 1000000) / \
    ^~~~~~~~~~~~~~~~
powerplay/hwmgr/polaris10_hwmgr.c:1824:4: error: this decimal constant is unsigned only in ISO C90 [-Werror]
    volt_with_cks = (uint32_t)((2999656000 + sclk_table->entries[i].clk * 392803/100 - (ro - 44) * 1000000) / \

This marks the new integer literals unsigned, which makes the calculation
more sensible and avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 0812a945fbb8 ("drm/amd/powerplay: Update CKS on/ CKS off voltage offset calculation")
---
 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
index ec2a7ada346a..5b26bbbc3e79 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
@@ -1814,14 +1814,14 @@ static int polaris10_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr)
 		data->smc_state_table.Sclk_CKS_masterEn0_7 |=
 				sclk_table->entries[i].cks_enable << i;
 		if (hwmgr->chip_id == CHIP_POLARIS10) {
-			volt_without_cks = (uint32_t)((2753594000 + (sclk_table->entries[i].clk/100) * 136418 -(ro - 70) * 1000000) / \
+			volt_without_cks = (uint32_t)((2753594000u + (sclk_table->entries[i].clk/100) * 136418 -(ro - 70) * 1000000) / \
 						(2424180 - (sclk_table->entries[i].clk/100) * 1132925/1000));
-			volt_with_cks = (uint32_t)((279720200 + sclk_table->entries[i].clk * 3232 - (ro - 65) * 100000000) / \
+			volt_with_cks = (uint32_t)((279720200u + sclk_table->entries[i].clk * 3232 - (ro - 65) * 100000000) / \
 					(252248000 - sclk_table->entries[i].clk/100 * 115764));
 		} else {
-			volt_without_cks = (uint32_t)((2416794800 + (sclk_table->entries[i].clk/100) * 1476925/10 -(ro - 50) * 1000000) / \
+			volt_without_cks = (uint32_t)((2416794800u + (sclk_table->entries[i].clk/100) * 1476925/10 -(ro - 50) * 1000000) / \
 						(2625416 - (sclk_table->entries[i].clk/100) * 12586807/10000));
-			volt_with_cks = (uint32_t)((2999656000 + sclk_table->entries[i].clk * 392803/100 - (ro - 44) * 1000000) / \
+			volt_with_cks = (uint32_t)((2999656000u + sclk_table->entries[i].clk * 392803/100 - (ro - 44) * 1000000) / \
 					(3422454 - sclk_table->entries[i].clk/100 * 18886376/10000));
 		}
 
-- 
2.9.0

                 reply	other threads:[~2016-07-04 13:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160704131849.1102843-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=JinHuiEric.Huang@amd.com \
    --cc=Rex.Zhu@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®