2021-09-29 07:00:50

by Yang Li

[permalink] [raw]
Subject: [PATCH -next] intel: Simplify bool conversion

Fix the following coccicheck warning:
./drivers/net/ethernet/intel/i40e/i40e_xsk.c:229:35-40: WARNING:
conversion to bool not needed here
./drivers/net/ethernet/intel/ice/ice_xsk.c:399:35-40: WARNING:
conversion to bool not needed here

Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Yang Li <[email protected]>
---
drivers/net/ethernet/intel/i40e/i40e_xsk.c | 2 +-
drivers/net/ethernet/intel/ice/ice_xsk.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
index 6f85879..ea06e95 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
@@ -226,7 +226,7 @@ bool i40e_alloc_rx_buffers_zc(struct i40e_ring *rx_ring, u16 count)
rx_desc->wb.qword1.status_error_len = 0;
i40e_release_rx_desc(rx_ring, ntu);

- return count == nb_buffs ? true : false;
+ return count == nb_buffs;
}

/**
diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
index 7682eaa..35b6e81 100644
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@ -396,7 +396,7 @@ bool ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, u16 count)
rx_desc->wb.status_error0 = 0;
ice_release_rx_desc(rx_ring, ntu);

- return count == nb_buffs ? true : false;
+ return count == nb_buffs;
}

/**
--
1.8.3.1


2021-09-29 17:43:47

by Tony Nguyen

[permalink] [raw]
Subject: Re: [PATCH -next] intel: Simplify bool conversion

On Wed, 2021-09-29 at 14:56 +0800, Yang Li wrote:
> Fix the following coccicheck warning:
> ./drivers/net/ethernet/intel/i40e/i40e_xsk.c:229:35-40: WARNING:
> conversion to bool not needed here
> ./drivers/net/ethernet/intel/ice/ice_xsk.c:399:35-40: WARNING:
> conversion to bool not needed here
>
> Reported-by: Abaci Robot <[email protected]>
> Signed-off-by: Yang Li <[email protected]>
> ---
> drivers/net/ethernet/intel/i40e/i40e_xsk.c | 2 +-
> drivers/net/ethernet/intel/ice/ice_xsk.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)

Acked-by: Tony Nguyen <[email protected]>

This applies to patches that went through BPF[1] and aren't on the
Intel wired LAN yet. BPF - did you want to pick this up?

[1]
https://patchwork.kernel.org/project/netdevbpf/list/?series=550775&stat
e=*

> diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> index 6f85879..ea06e95 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> @@ -226,7 +226,7 @@ bool i40e_alloc_rx_buffers_zc(struct i40e_ring
> *rx_ring, u16 count)
> rx_desc->wb.qword1.status_error_len = 0;
> i40e_release_rx_desc(rx_ring, ntu);
>
> - return count == nb_buffs ? true : false;
> + return count == nb_buffs;
> }
>
> /**
> diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c
> b/drivers/net/ethernet/intel/ice/ice_xsk.c
> index 7682eaa..35b6e81 100644
> --- a/drivers/net/ethernet/intel/ice/ice_xsk.c
> +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
> @@ -396,7 +396,7 @@ bool ice_alloc_rx_bufs_zc(struct ice_ring
> *rx_ring, u16 count)
> rx_desc->wb.status_error0 = 0;
> ice_release_rx_desc(rx_ring, ntu);
>
> - return count == nb_buffs ? true : false;
> + return count == nb_buffs;
> }
>
> /**

2021-10-25 22:14:29

by Brelinski, Tony

[permalink] [raw]
Subject: RE: [PATCH -next] intel: Simplify bool conversion

> -----Original Message-----
> From: Yang Li <[email protected]>
> Sent: Tuesday, September 28, 2021 11:56 PM
> To: [email protected]
> Cc: [email protected]; Brandeburg, Jesse
> <[email protected]>; Nguyen, Anthony L
> <[email protected]>; [email protected];
> [email protected]; [email protected]; Yang Li
> <[email protected]>
> Subject: [PATCH -next] intel: Simplify bool conversion
>
> Fix the following coccicheck warning:
> ./drivers/net/ethernet/intel/i40e/i40e_xsk.c:229:35-40: WARNING:
> conversion to bool not needed here
> ./drivers/net/ethernet/intel/ice/ice_xsk.c:399:35-40: WARNING:
> conversion to bool not needed here
>
> Reported-by: Abaci Robot <[email protected]>
> Signed-off-by: Yang Li <[email protected]>
> ---
> drivers/net/ethernet/intel/i40e/i40e_xsk.c | 2 +-
> drivers/net/ethernet/intel/ice/ice_xsk.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)

Tested-by: Tony Brelinski <[email protected]>