[PATCH 11/12] wifi: wilc1000: Use min() to improve code

Qianfeng Rong posted 12 patches 3 months ago
[PATCH 11/12] wifi: wilc1000: Use min() to improve code
Posted by Qianfeng Rong 3 months ago
Use min() to reduce the code and improve its readability.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 9d80adc45d6b..fedc7d59216a 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -1287,10 +1287,7 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer,
 
 		offset += 8;
 		while (((int)size) && (offset < buffer_size)) {
-			if (size <= blksz)
-				size2 = size;
-			else
-				size2 = blksz;
+			size2 = min(size, blksz);
 
 			memcpy(dma_buffer, &buffer[offset], size2);
 			ret = wilc->hif_func->hif_block_tx(wilc, addr,
-- 
2.34.1
Re: [PATCH 11/12] wifi: wilc1000: Use min() to improve code
Posted by Alexis Lothoré 3 months ago
On Wed Jul 9, 2025 at 4:21 AM CEST, Qianfeng Rong wrote:
> Use min() to reduce the code and improve its readability.
>
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>

Reviewed-by: Alexis Lothoré <alexis.lothore@bootlin.com>

Thanks,

Alexis


-- 
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com