From nobody Tue Dec 16 07:13:52 2025 Received: from out-170.mta0.migadu.com (out-170.mta0.migadu.com [91.218.175.170]) (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 7BA3820F97E for ; Tue, 14 Jan 2025 12:17:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736857062; cv=none; b=earWNdrDfLJUc01YbkXvjR/SBBTd4YOBRX1q4e9Wu0qw68Q8/GMRvqR0hH24P6+OdHXGHSqbqENXdYSvyMPCFTd24aiiFSqNUb9x8O32jJSLpc7PKGd4B9WXd2Bk088kR6mDy3nm/SNOJUX727f6KOv70ReuUQlH+HItlMQQM3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736857062; c=relaxed/simple; bh=a16ozpvO4mnZkpEOOWoM+JNGGPOZosE9X2L4jWrqZA4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=e/4swfEPc3ZYI3BczcS67PiQMKrubWZBb7XGKQB2Gn60VmD1GYeKgX4fAhrEmCpKzmddYz3yQqDWMwew3DyLfpWO91LByKAdUT6n8sSrAGOucq2STso1J9WCunMOl70QNi0J7qoLcprN1uomq8FsiU1nkWDt7YyI/ibA9+WXR3M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=lZCCQTjR; arc=none smtp.client-ip=91.218.175.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="lZCCQTjR" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1736857043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=sKwgNHcA7byEuhdNiyLBlSlFjymR3z5KIUpqSpX3U9E=; b=lZCCQTjRg5QknZ39Y8SrANiBn2EkZQwhZI1obiFvHLxFL6Ug5ssGd8/TvpbhU+hAPC2Kjq XgzLGlD19UCQywlE49Yt/YPK7vaZh9Q+zMXKI/F+3DSwERPYXb7ez5yUME7gRxSPdqNkZG 4Cb1Ksv3RzxPqiae2taYrISvNwfZAwY= From: Thorsten Blum To: Dinh Nguyen , Michael Turquette , Stephen Boyd Cc: Thorsten Blum , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] clk: socfpga: clk-pll: Optimize local variables Date: Tue, 14 Jan 2025 13:14:53 +0100 Message-ID: <20250114121453.618120-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Since readl() returns a u32, the local variables reg and bypass can also have the data type u32. Furthermore, divf and divq are derived from reg and can also be a u32. Since do_div() casts the divisor to u32 anyway, changing the data type of divq to u32 removes the following Coccinelle/coccicheck warning reported by do_div.cocci: WARNING: do_div() does a 64-by-32 division, please consider using div64_u= l instead Compile-tested only. Signed-off-by: Thorsten Blum Reviewed-by: Krzysztof Kozlowski --- drivers/clk/socfpga/clk-pll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/socfpga/clk-pll.c b/drivers/clk/socfpga/clk-pll.c index 9dcc1b2d2cc0..03a96139a576 100644 --- a/drivers/clk/socfpga/clk-pll.c +++ b/drivers/clk/socfpga/clk-pll.c @@ -39,9 +39,9 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *h= wclk, unsigned long parent_rate) { struct socfpga_pll *socfpgaclk =3D to_socfpga_clk(hwclk); - unsigned long divf, divq, reg; + u32 divf, divq, reg; unsigned long long vco_freq; - unsigned long bypass; + u32 bypass; =20 reg =3D readl(socfpgaclk->hw.reg); bypass =3D readl(clk_mgr_base_addr + CLKMGR_BYPASS); --=20 2.47.1