mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH linux-next] r8152: Replace conditional statement with min() function
@ 2022-09-14 16:23 cgel.zte
  2022-09-14 18:05 ` Greg KH
  2022-09-16  5:13 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: cgel.zte @ 2022-09-14 16:23 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, hayeswang
  Cc: aaron.ma, jflf_kernel, dober6023, svenva, linux-usb, netdev,
	linux-kernel, Jinpeng Cui, Zeal Robot

From: Jinpeng Cui <cui.jinpeng2@zte.com.cn>

Use the min() function instead of "if else" to get the minimum value.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
---
 drivers/net/usb/r8152.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index a51d8ded60f3..6cead36aef56 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -4829,10 +4829,7 @@ static void rtl_ram_code_speed_up(struct r8152 *tp, struct fw_phy_speed_up *phy,
 		u32 ocp_data, size;
 		int i;
 
-		if (len < 2048)
-			size = len;
-		else
-			size = 2048;
+		size = min(2048, len);
 
 		ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_GPHY_CTRL);
 		ocp_data |= GPHY_PATCH_DONE | BACKUP_RESTRORE;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-16  5:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14 16:23 [PATCH linux-next] r8152: Replace conditional statement with min() function cgel.zte
2022-09-14 18:05 ` Greg KH
2022-09-16  5:13 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®