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

You Kangren posted 1 patch 2 years, 7 months ago
There is a newer version of this series
drivers/net/wireless/legacy/ray_cs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH v2] wifi: ray_cs: Replace the ternary conditional operator with min()
Posted by You Kangren 2 years, 7 months ago
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..5f97fcf5c4ba 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(rx_len < sizeof(struct beacon_rx)));
 
 		local->beacon_rxed = 1;
 		/* Get the statistics so the card counters never overflow */
-- 
2.39.0
Re: [PATCH v2] wifi: ray_cs: Replace the ternary conditional operator with min()
Posted by Julian Calaby 2 years, 7 months ago
Hi You,

On Tue, Jun 27, 2023 at 11:24 AM You Kangren <youkangren@vivo.com> 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..5f97fcf5c4ba 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(rx_len < sizeof(struct beacon_rx)));

This is obviously bogus, did you compile this before posting it?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/