Skip to contentSkip to conversation

iwlwifi: fix compare_const_fl.cocci warnings

PATCH In review Julia Lawall 2 participants 2 messages Nov 27, 2015 – Nov 28, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iwlwifi: fix compare_const_fl.cocci warnings

Move constants to the right of binary operators.

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

---

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

 calib.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/dvm/calib.c +1 -1
@@ -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;
#1 lore raw

Hi Julia,

Quoted 9 lines · Julia Lawall

Move constants to the right of binary operators.

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

---

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.

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

drivers/net/wireless/intel/iwlwifi/dvm/calib.c static int iwl_sens_energy_cck(struct iw · line 317

Quoted 8 lines
drivers/net/wireless/intel/iwlwifi/dvm/calib.c +1 -1
@@ -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-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html