]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: wilc1000: Use min() to improve code
authorQianfeng Rong <rongqianfeng@vivo.com>
Tue, 15 Jul 2025 12:16:52 +0000 (20:16 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 18 Jul 2025 12:14:07 +0000 (14:14 +0200)
Use min() to reduce the code and improve its readability.

Reviewed-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Link: https://patch.msgid.link/20250715121721.266713-7-rongqianfeng@vivo.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/microchip/wilc1000/wlan.c

index 9d80adc45d6be14c8818e8ef1643db6875cf57d2..fedc7d59216adcf72bd537c3c27b5c116b39da77 100644 (file)
@@ -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,