From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC8A246AA71; Tue, 21 Jul 2026 15:40:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784648423; cv=none; b=W5EU4kGAJNJGDyOeqpCbXzYB0nHZigC9YQ3GiYaSOVOZLvPLjRtOSzQ/7EXHo3ijFLuuO8uV/FUdQ/CX7fF6m8NXnScKy+nLA/+hMVc385bkVvjGogiEEJPLC8A3qmjQpke1ijGdaFydgxPIC0YepxNsrt+a36yo5Bf8L5QfrfQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784648423; c=relaxed/simple; bh=cgnIqRuImGTNVkEZq5QHmX7T69rmKNDsfUCSIBovla4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PJfr73EcqYT2G800MDblDm9lhttZG43B4A+z0I2RsVX87x7SxZEbPy5p37QQn/37ZtVb+pDep6MQFtGMpPKF+TTI9y7XUr31tONbyMH+z0TbsGlZjbPIfN7xpte7e4wVopUAH9Qh9Sy4EyVON67B7rX87X1xnQuT8Kiv+iNxzX0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QqxP2YBw; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="QqxP2YBw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BCED1F000E9; Tue, 21 Jul 2026 15:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784648420; bh=8fQEFHDQU9zfXH2gUKH16GtW0/y9Vg3C1ptRWJqTVKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QqxP2YBwS99yVIcO6AJ6pL/TzaNd2LQROiJFDNeL9EwBCcKUMwDJCIWz3o1AH//o8 zbWO/o93MfkutZVKgQrhM2Jr8Ds708wrGKn4GI3lYFf6bFQdzz1VVnfcSpmjRpa1/M IttLK5ZJw1VosGevK+O/vdioaaj5waxhwZdC90KM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Cristian Marussi , Florian Fainelli , Geert Uytterhoeven , Brian Masney , Sudeep Holla , Sasha Levin Subject: [PATCH 7.1 0194/2077] clk: scmi: Fix clock rate rounding Date: Tue, 21 Jul 2026 16:57:47 +0200 Message-ID: <20260721152557.258574991@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152552.646164743@linuxfoundation.org> References: <20260721152552.646164743@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Cristian Marussi [ Upstream commit d0c81a38d06d446d341532700b3a4a43d3b00eb1 ] While the do_div() helper used for rounding expects its divisor argument to be a 32bits quantity, the currently provided divisor parameter is a 64bit value that, as a consequence, is silently truncated and a possible source of bugs. Fix by using the proper div64_ul helper. Cc: Michael Turquette Cc: Stephen Boyd Cc: linux-clk@vger.kernel.org Fixes: 7a8655e19bdb ("clk: scmi: Fix the rounding of clock rate") Signed-off-by: Cristian Marussi Tested-by: Florian Fainelli Tested-by: Geert Uytterhoeven Link: https://patch.msgid.link/20260508153300.2224715-2-cristian.marussi@arm.com Reviewed-by: Brian Masney Signed-off-by: Sudeep Holla Signed-off-by: Sasha Levin --- drivers/clk/clk-scmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c index 6b286ea6f1218c..b6a12f3bc123c9 100644 --- a/drivers/clk/clk-scmi.c +++ b/drivers/clk/clk-scmi.c @@ -10,9 +10,9 @@ #include #include #include +#include #include #include -#include #define NOT_ATOMIC false #define ATOMIC true @@ -83,7 +83,7 @@ static int scmi_clk_determine_rate(struct clk_hw *hw, ftmp = req->rate - fmin; ftmp += clk->info->range.step_size - 1; /* to round up */ - do_div(ftmp, clk->info->range.step_size); + ftmp = div64_ul(ftmp, clk->info->range.step_size); req->rate = ftmp * clk->info->range.step_size + fmin; -- 2.53.0