From patchwork Thu Nov 2 11:26:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10038553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F23206032D for ; Thu, 2 Nov 2017 11:27:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E60AE28E45 for ; Thu, 2 Nov 2017 11:27:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA76B28E90; Thu, 2 Nov 2017 11:27:43 +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=-4.2 required=2.0 tests=BAYES_00, 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 A2F4B28E45 for ; Thu, 2 Nov 2017 11:27:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 15B216E8F2; Thu, 2 Nov 2017 11:27:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id 283EA6E8F2 for ; Thu, 2 Nov 2017 11:27:40 +0000 (UTC) Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0M8hmN-1dEQJK2gHT-00wBJz; Thu, 02 Nov 2017 12:27:33 +0100 From: Arnd Bergmann To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= Subject: [PATCH 3/3] drm/amdgpu/display: fix integer arithmetic problem Date: Thu, 2 Nov 2017 12:26:43 +0100 Message-Id: <20171102112657.111405-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171102112657.111405-1-arnd@arndb.de> References: <20171102112657.111405-1-arnd@arndb.de> X-Provags-ID: V03:K0:sTYaLgEnB+dgWrtDykqTffpw4GKC9CdbyBtvHCo2OSO8th8f3T0 AO+pAW1uCdj/6wryiK5+Vf1V5fy62lqjMpU0NAnn57mQf9wW415DmlKmk5nm0mJ5/eDzmDx rxwIGps2oSfFoZ8LD9w9/Lw4AWCDs2HRgi6hviHNszE5UyhSMv1T6y7jaEqVPxZLja9yf07 y2yRega7UFzrnAXe9FZZQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:ZDDlfzMdTJQ=:5Xr/dpjUeImQDLn8eq93JO pt8HfwW9ZWVeXeFgr6zF5RtHFtkJdGQWo8ztD1spzs1KtlLx/qXzAMOAGEOk403RbMYFkBRx0 bQEkpDZPav07JzV8EaPv5OscOoE2RkW4khnNtdsdzpsDsBvdDRvnPSSSdjO0bRiNI9SAF2wCd Ivqteqy6ImuhC+6DvKnWZK08K11mKe29NVKGyqozNu3gJEWQbD4uQH77HUDfBHcXZWkl1rMrg MBMLScBiCo1XonetcCAl8dEXS/OvfHbEGThR6IQn9pd7mdv6Azx3+STtEVwjqIJ9ku3ZAuu30 gtTXZiedlGV2mf4Jqf8/ccgKSqsrBr6LfOgrqV9hkVmwAHnSsRpESi0HE/v5s4xrcNRMLsZOs lQNCQqlkaeN+zYNwHwndb5JXcD3WZLEOXlzJKOUQGb9KVWUpxjIZ2fIwiO6CgqD54OtwzBvep 7OJcSHewQk19I0Ck4hJja08po1JUWEa1CW8U3g3IhtcHVngcPSk+kf6llSO/RtnO29ChQTR8H bi0UR1BuZfmXw1ul7L+kCUw5RSffy3bXP5bYZlixbc4DyoxLtl+VxJnNEVCqDd+5VtelQ2rRQ YPI/Jfj1giUdorFABXudQ9HSAMGHGv65DoCLoE2xlgaLxy3+55sBak7q5yCHxc/6oJpJWH67N /MPAwv+ekuOzbIOkGzNXYv/8/B7j0H03uV+JKmj+rUb8Y3+MwcsI84r2zvtF1J4S2+t1s6aYT BGUXnvpwVrVpbINaYG+FlTmUNXnx9vSILjzqAA== Cc: Joshua Aberback , Arnd Bergmann , David Airlie , linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, "Leo \(Sunpeng\) Li" , Dmytro Laktyushkin , dri-devel@lists.freedesktop.org, Tony Cheng X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP gcc warns about an ambiguous integer calculation: drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c: In function 'calculate_bandwidth': drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:534:5: error: this decimal constant is unsigned only in ISO C90 [-Werror] data->lb_line_pitch = bw_ceil2(bw_mul(bw_div(bw_frc_to_fixed(2401171875, 100000000), bw_int_to_fixed(3)), bw_ceil2(data->source_width_in_lb, bw_int_to_fixed(8))), bw_int_to_fixed(48)); ^~~~ Marking the constant as explicitly unsigned makes it work fine everywhere without warnings. Signed-off-by: Arnd Bergmann Reviewed-by: Harry Wentland --- drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c index 15cbfc400633..4f8a95368ffc 100644 --- a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +++ b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c @@ -531,7 +531,7 @@ static void calculate_bandwidth( } switch (data->lb_bpc[i]) { case 8: - data->lb_line_pitch = bw_ceil2(bw_mul(bw_div(bw_frc_to_fixed(2401171875, 100000000), bw_int_to_fixed(3)), bw_ceil2(data->source_width_in_lb, bw_int_to_fixed(8))), bw_int_to_fixed(48)); + data->lb_line_pitch = bw_ceil2(bw_mul(bw_div(bw_frc_to_fixed(2401171875ul, 100000000), bw_int_to_fixed(3)), bw_ceil2(data->source_width_in_lb, bw_int_to_fixed(8))), bw_int_to_fixed(48)); break; case 10: data->lb_line_pitch = bw_ceil2(bw_mul(bw_div(bw_frc_to_fixed(300234375, 10000000), bw_int_to_fixed(3)), bw_ceil2(data->source_width_in_lb, bw_int_to_fixed(8))), bw_int_to_fixed(48));