public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 -next] wifi: ipw2x00: fix bad alignments
@ 2024-11-01  2:22 Jiapeng Chong
  2024-11-01  2:43 ` Ping-Ke Shih
  2024-11-01  5:59 ` Kalle Valo
  0 siblings, 2 replies; 4+ messages in thread
From: Jiapeng Chong @ 2024-11-01  2:22 UTC (permalink / raw)
  To: stas.yakovlev
  Cc: kvalo, linux-wireless, linux-kernel, Jiapeng Chong, Abaci Robot

This patch fixes incorrect code alignment.

./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:871:2-3: code aligned with following code on line 882.
./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:886:2-3: code aligned with following code on line 900.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11381
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
Changes in v2:
  -Replace the & in the if statement with &&. Add 'wifi: ' to subject.

 .../net/wireless/intel/ipw2x00/libipw_rx.c    | 44 +++++++++----------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
index 7e41cb7bbfe0..38731f67cb54 100644
--- a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
+++ b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
@@ -868,34 +868,34 @@ void libipw_rx_any(struct libipw_device *ieee,
 	case IW_MODE_ADHOC:
 		/* our BSS and not from/to DS */
 		if (ether_addr_equal(hdr->addr3, ieee->bssid))
-		if ((fc & (IEEE80211_FCTL_TODS+IEEE80211_FCTL_FROMDS)) == 0) {
-			/* promisc: get all */
-			if (ieee->dev->flags & IFF_PROMISC)
-				is_packet_for_us = 1;
-			/* to us */
-			else if (ether_addr_equal(hdr->addr1, ieee->dev->dev_addr))
-				is_packet_for_us = 1;
-			/* mcast */
-			else if (is_multicast_ether_addr(hdr->addr1))
-				is_packet_for_us = 1;
+			if ((fc && (IEEE80211_FCTL_TODS + IEEE80211_FCTL_FROMDS)) == 0) {
+				/* promisc: get all */
+				if (ieee->dev->flags & IFF_PROMISC)
+					is_packet_for_us = 1;
+				/* to us */
+				else if (ether_addr_equal(hdr->addr1, ieee->dev->dev_addr))
+					is_packet_for_us = 1;
+				/* mcast */
+				else if (is_multicast_ether_addr(hdr->addr1))
+					is_packet_for_us = 1;
 		}
 		break;
 	case IW_MODE_INFRA:
 		/* our BSS (== from our AP) and from DS */
 		if (ether_addr_equal(hdr->addr2, ieee->bssid))
-		if ((fc & (IEEE80211_FCTL_TODS+IEEE80211_FCTL_FROMDS)) == IEEE80211_FCTL_FROMDS) {
-			/* promisc: get all */
-			if (ieee->dev->flags & IFF_PROMISC)
-				is_packet_for_us = 1;
-			/* to us */
-			else if (ether_addr_equal(hdr->addr1, ieee->dev->dev_addr))
-				is_packet_for_us = 1;
-			/* mcast */
-			else if (is_multicast_ether_addr(hdr->addr1)) {
-				/* not our own packet bcasted from AP */
-				if (!ether_addr_equal(hdr->addr3, ieee->dev->dev_addr))
+			if ((fc && (IEEE80211_FCTL_TODS + IEEE80211_FCTL_FROMDS)) == IEEE80211_FCTL_FROMDS) {
+				/* promisc: get all */
+				if (ieee->dev->flags & IFF_PROMISC)
 					is_packet_for_us = 1;
-			}
+				/* to us */
+				else if (ether_addr_equal(hdr->addr1, ieee->dev->dev_addr))
+					is_packet_for_us = 1;
+				/* mcast */
+				else if (is_multicast_ether_addr(hdr->addr1)) {
+					/* not our own packet bcasted from AP */
+					if (!ether_addr_equal(hdr->addr3, ieee->dev->dev_addr))
+						is_packet_for_us = 1;
+				}
 		}
 		break;
 	default:
-- 
2.32.0.3.g01195cf9f


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH v2 -next] wifi: ipw2x00: fix bad alignments
  2024-11-01  2:22 [PATCH v2 -next] wifi: ipw2x00: fix bad alignments Jiapeng Chong
@ 2024-11-01  2:43 ` Ping-Ke Shih
  2024-11-01  7:13   ` Kalle Valo
  2024-11-01  5:59 ` Kalle Valo
  1 sibling, 1 reply; 4+ messages in thread
From: Ping-Ke Shih @ 2024-11-01  2:43 UTC (permalink / raw)
  To: Jiapeng Chong, stas.yakovlev@gmail.com
  Cc: kvalo@kernel.org, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org, Abaci Robot

Jiapeng Chong <jiapeng.chong@linux.alibaba.com> wrote:
> This patch fixes incorrect code alignment.
> 
> ./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:871:2-3: code aligned with following code on line 882.
> ./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:886:2-3: code aligned with following code on line 900.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11381
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> Changes in v2:
>   -Replace the & in the if statement with &&.

I feel what Kalle meant is like this:

if (ether_addr_equal(hdr->addr3, ieee->bssid) &&
    (fc & (IEEE80211_FCTL_TODS + IEEE80211_FCTL_FROMDS)) == 0)




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 -next] wifi: ipw2x00: fix bad alignments
  2024-11-01  2:22 [PATCH v2 -next] wifi: ipw2x00: fix bad alignments Jiapeng Chong
  2024-11-01  2:43 ` Ping-Ke Shih
@ 2024-11-01  5:59 ` Kalle Valo
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2024-11-01  5:59 UTC (permalink / raw)
  To: Jiapeng Chong; +Cc: stas.yakovlev, linux-wireless, linux-kernel, Abaci Robot

Jiapeng Chong <jiapeng.chong@linux.alibaba.com> writes:

> This patch fixes incorrect code alignment.
>
> ./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:871:2-3: code aligned with following code on line 882.
> ./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:886:2-3: code aligned with following code on line 900.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11381
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> Changes in v2:
>   -Replace the & in the if statement with &&. Add 'wifi: ' to subject.
>
>  .../net/wireless/intel/ipw2x00/libipw_rx.c    | 44 +++++++++----------
>  1 file changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
> index 7e41cb7bbfe0..38731f67cb54 100644
> --- a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
> +++ b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
> @@ -868,34 +868,34 @@ void libipw_rx_any(struct libipw_device *ieee,
>  	case IW_MODE_ADHOC:
>  		/* our BSS and not from/to DS */
>  		if (ether_addr_equal(hdr->addr3, ieee->bssid))
> -		if ((fc & (IEEE80211_FCTL_TODS+IEEE80211_FCTL_FROMDS)) == 0) {
> -			/* promisc: get all */
> -			if (ieee->dev->flags & IFF_PROMISC)
> -				is_packet_for_us = 1;
> -			/* to us */
> -			else if (ether_addr_equal(hdr->addr1, ieee->dev->dev_addr))
> -				is_packet_for_us = 1;
> -			/* mcast */
> -			else if (is_multicast_ether_addr(hdr->addr1))
> -				is_packet_for_us = 1;
> +			if ((fc && (IEEE80211_FCTL_TODS + IEEE80211_FCTL_FROMDS)) == 0) {

I meant instead of using two nested if statements you can use only one
if statement with '&&' operator.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 -next] wifi: ipw2x00: fix bad alignments
  2024-11-01  2:43 ` Ping-Ke Shih
@ 2024-11-01  7:13   ` Kalle Valo
  0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2024-11-01  7:13 UTC (permalink / raw)
  To: Ping-Ke Shih
  Cc: Jiapeng Chong, stas.yakovlev@gmail.com,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Abaci Robot

Ping-Ke Shih <pkshih@realtek.com> writes:

> Jiapeng Chong <jiapeng.chong@linux.alibaba.com> wrote:
>> This patch fixes incorrect code alignment.
>> 
>> ./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:871:2-3: code
>> aligned with following code on line 882.
>> ./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:886:2-3: code
>> aligned with following code on line 900.
>> 
>> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
>> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11381
>> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
>> ---
>> Changes in v2:
>>   -Replace the & in the if statement with &&.
>
> I feel what Kalle meant is like this:
>
> if (ether_addr_equal(hdr->addr3, ieee->bssid) &&
>     (fc & (IEEE80211_FCTL_TODS + IEEE80211_FCTL_FROMDS)) == 0)

Exactly, thanks Ping.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-01  7:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-01  2:22 [PATCH v2 -next] wifi: ipw2x00: fix bad alignments Jiapeng Chong
2024-11-01  2:43 ` Ping-Ke Shih
2024-11-01  7:13   ` Kalle Valo
2024-11-01  5:59 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox