diff mbox series

[v3] wifi: ray_cs: Replace the ternary conditional operator with min()

Message ID 20230627043151.19576-1-youkangren@vivo.com
State Superseded
Headers show
Series [v3] wifi: ray_cs: Replace the ternary conditional operator with min() | expand

Commit Message

You Kangren June 27, 2023, 4:31 a.m. UTC
Replace the ternary conditional operator with min_t() to simplify the code

Signed-off-by: You Kangren <youkangren@vivo.com>
---
 drivers/net/wireless/legacy/ray_cs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Simon Horman June 29, 2023, 8:05 p.m. UTC | #1
On Tue, Jun 27, 2023 at 12:31:48PM +0800, You Kangren wrote:
> Replace the ternary conditional operator with min_t() to simplify the code
> 
> Signed-off-by: You Kangren <youkangren@vivo.com>
> ---
>  drivers/net/wireless/legacy/ray_cs.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c
> index 8ace797ce951..25edbc655738 100644
> --- a/drivers/net/wireless/legacy/ray_cs.c
> +++ b/drivers/net/wireless/legacy/ray_cs.c
> @@ -2086,8 +2086,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local,
>  			rx_data(dev, prcs, pkt_addr, rx_len);
>  
>  		copy_from_rx_buff(local, (UCHAR *) &local->last_bcn, pkt_addr,
> -				  rx_len < sizeof(struct beacon_rx) ?
> -				  rx_len : sizeof(struct beacon_rx));
> +				  min_t(size_t, rx_len, sizeof(struct beacon_rx));

Hi You Kangen,

unfortunately this patch doesn't seem to compile.
diff mbox series

Patch

diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c
index 8ace797ce951..25edbc655738 100644
--- a/drivers/net/wireless/legacy/ray_cs.c
+++ b/drivers/net/wireless/legacy/ray_cs.c
@@ -2086,8 +2086,7 @@  static void ray_rx(struct net_device *dev, ray_dev_t *local,
 			rx_data(dev, prcs, pkt_addr, rx_len);
 
 		copy_from_rx_buff(local, (UCHAR *) &local->last_bcn, pkt_addr,
-				  rx_len < sizeof(struct beacon_rx) ?
-				  rx_len : sizeof(struct beacon_rx));
+				  min_t(size_t, rx_len, sizeof(struct beacon_rx));
 
 		local->beacon_rxed = 1;
 		/* Get the statistics so the card counters never overflow */