diff mbox series

ath9k: remove setting of 'is_ext' parameter

Message ID 20220521204725.2539952-1-trix@redhat.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series ath9k: remove setting of 'is_ext' parameter | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Tom Rix May 21, 2022, 8:47 p.m. UTC
cppcheck reports
[drivers/net/wireless/ath/ath9k/dfs.c:93]: (style) Assignment of function parameter has no effect outside the function.

Both the is_ctl and the is_ext parameters are set in the if-else statement.
But only is_ctl is used later, so setting is_ext is not needed and can be removed.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/wireless/ath/ath9k/dfs.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Toke Høiland-Jørgensen May 23, 2022, 9:32 a.m. UTC | #1
Tom Rix <trix@redhat.com> writes:

> cppcheck reports
> [drivers/net/wireless/ath/ath9k/dfs.c:93]: (style) Assignment of function parameter has no effect outside the function.
>
> Both the is_ctl and the is_ext parameters are set in the if-else statement.
> But only is_ctl is used later, so setting is_ext is not needed and can be removed.
>
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  drivers/net/wireless/ath/ath9k/dfs.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c
> index acb9602aa464..47cdfb584eb0 100644
> --- a/drivers/net/wireless/ath/ath9k/dfs.c
> +++ b/drivers/net/wireless/ath/ath9k/dfs.c
> @@ -89,8 +89,6 @@ static int ath9k_get_max_index_ht40(struct ath9k_dfs_fft_40 *fft,
>  			int mag_upper = fft_max_magnitude(fft->upper_bins);
>  			if (mag_upper > mag_lower)
>  				is_ctl = false;
> -			else
> -				is_ext = false;

Hmm, not so sure about this; while the assignment is technically
useless, I think it makes the intent of the code clearer (i.e.,
disambiguating between is_ctl or is_ext; upon exiting that block is_ctl
or is_ext will always be false(...

-Toke
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c
index acb9602aa464..47cdfb584eb0 100644
--- a/drivers/net/wireless/ath/ath9k/dfs.c
+++ b/drivers/net/wireless/ath/ath9k/dfs.c
@@ -89,8 +89,6 @@  static int ath9k_get_max_index_ht40(struct ath9k_dfs_fft_40 *fft,
 			int mag_upper = fft_max_magnitude(fft->upper_bins);
 			if (mag_upper > mag_lower)
 				is_ctl = false;
-			else
-				is_ext = false;
 		}
 	}
 	if (is_ctl)