Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1278870 > unrolled thread

[PATCH] iwlwifi: fix compare_const_fl.cocci warnings

Started byJulia Lawall <julia.lawall@lip6.fr>
First post2015-11-27 17:20 +0100
Last post2015-11-28 19:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] iwlwifi: fix compare_const_fl.cocci warnings Julia Lawall <julia.lawall@lip6.fr> - 2015-11-27 17:20 +0100
    Re: [PATCH] iwlwifi: fix compare_const_fl.cocci warnings "Grumbach, Emmanuel" <emmanuel.grumbach@intel.com> - 2015-11-28 19:50 +0100

#1278870 — [PATCH] iwlwifi: fix compare_const_fl.cocci warnings

FromJulia Lawall <julia.lawall@lip6.fr>
Date2015-11-27 17:20 +0100
Subject[PATCH] iwlwifi: fix compare_const_fl.cocci warnings
Message-ID<qztUB-5dg-3@gated-at.bofh.it>
Move constants to the right of binary operators.

Generated by: scripts/coccinelle/misc/compare_const_fl.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
---

This looks a bit nicer around the other way, in my opinion.

 calib.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/wireless/intel/iwlwifi/dvm/calib.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/calib.c
@@ -311,7 +311,7 @@ static int iwl_sens_energy_cck(struct iw
 		/* If previous beacon had too many false alarms,
 		 *   give it some extra margin by reducing sensitivity again
 		 *   (but don't go below measured energy of desired Rx) */
-		if (IWL_FA_TOO_MANY == data->nrg_prev_state) {
+		if (data->nrg_prev_state == IWL_FA_TOO_MANY) {
 			IWL_DEBUG_CALIB(priv, "... increasing margin\n");
 			if (data->nrg_th_cck > (max_nrg_cck + NRG_MARGIN))
 				data->nrg_th_cck -= NRG_MARGIN;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1279197

From"Grumbach, Emmanuel" <emmanuel.grumbach@intel.com>
Date2015-11-28 19:50 +0100
Message-ID<qzSJj-459-9@gated-at.bofh.it>
In reply to#1278870
Hi Julia,

On 11/27/2015 06:11 PM, Julia Lawall wrote:
> Move constants to the right of binary operators.
>
> Generated by: scripts/coccinelle/misc/compare_const_fl.cocci
>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
> ---
>
> This looks a bit nicer around the other way, in my opinion.

Thanks, I picked it up. I agree with your taste although having
constants on the left side can avoid the typo = instead of == since they
can't be an l-value. Obviously we never do that and prefer to have the
constant on the right side. More readable for sure.
>
>  calib.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/drivers/net/wireless/intel/iwlwifi/dvm/calib.c
> +++ b/drivers/net/wireless/intel/iwlwifi/dvm/calib.c
> @@ -311,7 +311,7 @@ static int iwl_sens_energy_cck(struct iw
>  		/* If previous beacon had too many false alarms,
>  		 *   give it some extra margin by reducing sensitivity again
>  		 *   (but don't go below measured energy of desired Rx) */
> -		if (IWL_FA_TOO_MANY == data->nrg_prev_state) {
> +		if (data->nrg_prev_state == IWL_FA_TOO_MANY) {
>  			IWL_DEBUG_CALIB(priv, "... increasing margin\n");
>  			if (data->nrg_th_cck > (max_nrg_cck + NRG_MARGIN))
>  				data->nrg_th_cck -= NRG_MARGIN;
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web