Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2491127ybi; Mon, 17 Jun 2019 05:52:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgY9R0st2qqmradzeodmYtbvhHUaT7Y/Gl/N8VB7I/9aXkxn+ZrqHSNvN2c+gP2NUVSshb X-Received: by 2002:a63:c006:: with SMTP id h6mr42110724pgg.285.1560775929441; Mon, 17 Jun 2019 05:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560775929; cv=none; d=google.com; s=arc-20160816; b=N6qRXVK8HwIy0JTBge//vwuHvMeLwnFqtCFXEgU9PsYhDZFSXz9VMe51USksG4ZXRH KK+SzLfu4oLuGqq/xcXIZaJwj32pM/1YRMOOYE3v7NbcNVG7w/yFQjFNzXv0guQGhfw0 HJBlbFHu2WmZhQRn5icbPAjYhjlB5diHQxxcYIeShGg6kjzgqCOXOce+HH+S7zL4PwSH LLDhELb4XU9lGaLs0xV6IzGbrMfWh6xu0Q4sgerwjHosf3GqWGAs4SG8zv6qfGNFUIiy myG1GxBv4mRA8LXhrYuZ8bkmDXTeuwQ9E7Zv5mjZ1nRXLylisko02jtziLikyUSb4HsC 0kNQ== 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 :message-id:date:subject:cc:to:from; bh=CVR8G7WurYtce7/xQewQt4UoBYp4F+FE24N5Tb65vSQ=; b=lwYJ0wDnAx6YrBOWWGSOg44Js9FE1MkBDHov4FUh0ywqLgXFNDLBK5qlgjXdgSSDaN eXIP/U21EwXRZcy2pREWUwGuFucq+oYZZwckRkE2bV7MJutbCzbTGDJgznSJWFF8N2IV Qk8pbxb3bpSohABtAvNh9jEmngV0TwEczWRbsLQEoTa6fA0t8Ey0MWu/c7IMGLzbggXJ UDK9JLGHGKL31swJCBLGE8aUrjQt2iIdiL0165kaJb2qx/S8ibWgYwuBeH3a9MXDzAwY LXli6hLkvfRusViiZ8xPXSXGeNoQAtLUBw0aPlhy5ykQX/LxNhCbK5ypN8woct0rZkuO kbhw== ARC-Authentication-Results: i=1; mx.google.com; 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 d9si10722810pgj.505.2019.06.17.05.51.53; Mon, 17 Jun 2019 05:52:09 -0700 (PDT) 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; 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 S1728088AbfFQMvc (ORCPT + 99 others); Mon, 17 Jun 2019 08:51:32 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:52071 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726694AbfFQMva (ORCPT ); Mon, 17 Jun 2019 08:51:30 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mae7u-1iDYhN3MgU-00cAt7; Mon, 17 Jun 2019 14:51:23 +0200 From: Arnd Bergmann To: "James (Qian) Wang" , Liviu Dudau , Brian Starkey , David Airlie , Daniel Vetter Cc: Arnd Bergmann , "Lowry Li (Arm Technology China)" , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/komeda: fix 32-bit komeda_crtc_update_clock_ratio Date: Mon, 17 Jun 2019 14:51:04 +0200 Message-Id: <20190617125121.1414507-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-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A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org clang points out a bug in the clock calculation on 32-bit, that leads to the clock_ratio always being zero: drivers/gpu/drm/arm/display/komeda/komeda_crtc.c:31:36: error: shift count >= width of type [-Werror,-Wshift-count-overflow] aclk = komeda_calc_aclk(kcrtc_st) << 32; Move the shift into the division to make it apply on a 64-bit variable. Also use the more expensive div64_u64() instead of div_u64() to account for pxlclk being a 64-bit integer. Fixes: a962091227ed ("drm/komeda: Add engine clock requirement check for the downscaling") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/arm/display/komeda/komeda_crtc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index cafb4457e187..3f222f464eb2 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -28,10 +28,9 @@ static void komeda_crtc_update_clock_ratio(struct komeda_crtc_state *kcrtc_st) } pxlclk = kcrtc_st->base.adjusted_mode.clock * 1000; - aclk = komeda_calc_aclk(kcrtc_st) << 32; + aclk = komeda_calc_aclk(kcrtc_st); - do_div(aclk, pxlclk); - kcrtc_st->clock_ratio = aclk; + kcrtc_st->clock_ratio = div64_u64(aclk << 32, pxlclk); } /** -- 2.20.0