lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251222100338.634144-1-thorsten.blum@linux.dev>
Date: Mon, 22 Dec 2025 11:03:33 +0100
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Robert Richter <rric@...nel.org>,
	Ulf Hansson <ulf.hansson@...aro.org>,
	Huacai Chen <chenhuacai@...nel.org>,
	Binbin Zhou <zhoubinbin@...ngson.cn>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
	linux-mmc@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] mmc: cavium: Use clamp to simplify cvm_mmc_set_clock

Use clamp() to simplify cvm_mmc_set_clock() and improve its readability.

Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
---
 drivers/mmc/host/cavium.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mmc/host/cavium.c b/drivers/mmc/host/cavium.c
index 9a55db0e657c..37a88f2a0c86 100644
--- a/drivers/mmc/host/cavium.c
+++ b/drivers/mmc/host/cavium.c
@@ -905,9 +905,7 @@ static void cvm_mmc_set_clock(struct cvm_mmc_slot *slot, unsigned int clock)
 {
 	struct mmc_host *mmc = slot->mmc;
 
-	clock = min(clock, mmc->f_max);
-	clock = max(clock, mmc->f_min);
-	slot->clock = clock;
+	slot->clock = clamp(clock, mmc->f_min, mmc->f_max);
 }
 
 static int cvm_mmc_init_lowlevel(struct cvm_mmc_slot *slot)
-- 
Thorsten Blum <thorsten.blum@...ux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ