Skip to contentSkip to conversation

iwlwifi: cleanup a mask shift in iwlagn_bt_traffic_is_sco()

PATCH In review Dan Carpenter 2 participants 2 messages Oct 29, 2014

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

PATCH 1/1 iwlwifi: cleanup a mask shift in iwlagn_bt_traffic_is_sco()

The shift operation is higher precedence so the code is wrong and it sets of a static checker warning. But it doesn't affect real life because BT_UART_MSG_FRAME3SCOESCO_POS is zero so the shift is a no-op.

I have re-written it in normal style and with parenthesis as a cleanup and to silence the static checker warning.

drivers/net/wireless/iwlwifi/dvm/lib.c +1 -1
index 2191621..065d3d5 100644
@@ -418,7 +418,7 @@ void iwlagn_bt_adjust_rssi_monitor(struct iwl_priv *priv, bool rssi_ena)
 
 static bool iwlagn_bt_traffic_is_sco(struct iwl_bt_uart_msg *uart_msg)
 {
-	return BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3 >>
+	return (uart_msg->frame3 & BT_UART_MSG_FRAME3SCOESCO_MSK) >>
 			BT_UART_MSG_FRAME3SCOESCO_POS;
 }
 
#1 lore raw
Quoted 9 lines · Dan Carpenter

The shift operation is higher precedence so the code is wrong and it sets of a static checker warning. But it doesn't affect real life because BT_UART_MSG_FRAME3SCOESCO_POS is zero so the shift is a no-op.

I have re-written it in normal style and with parenthesis as a cleanup and to silence the static checker warning.

In my tree already - I got it from Joe.

https://git.kernel.org/cgit/linux/kernel/git/iwlwifi/iwlwifi-next.git/commit/?idPf6635afe565a0e1c5ab78f040294fe1dc41de0