* [PATCH v2] wifi: ray_cs: Remove unnecessary conditional statements
@ 2023-06-27 2:42 You Kangren
2023-06-30 14:01 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: You Kangren @ 2023-06-27 2:42 UTC (permalink / raw)
To: Kalle Valo, You Kangren, Dongliang Mu, Christophe JAILLET,
Simon Horman,
open list:RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER, open list
Cc: opensource.kernel
Remove unnecessary conditional statements to simplify the code
Signed-off-by: You Kangren <youkangren@vivo.com>
---
drivers/net/wireless/legacy/ray_cs.c | 30 ++++++----------------------
1 file changed, 6 insertions(+), 24 deletions(-)
diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c
index 5f97fcf5c4ba..e4ea22316a03 100644
--- a/drivers/net/wireless/legacy/ray_cs.c
+++ b/drivers/net/wireless/legacy/ray_cs.c
@@ -2115,30 +2115,12 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
u_char linksrcaddr[ETH_ALEN]; /* Other end of the wireless link */
#endif
- if (!sniffer) {
- if (translate) {
-/* TBD length needs fixing for translated header */
- if (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) ||
- rx_len >
- (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN +
- FCS_LEN)) {
- pr_debug(
- "ray_cs invalid packet length %d received\n",
- rx_len);
- return;
- }
- } else { /* encapsulated ethernet */
-
- if (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) ||
- rx_len >
- (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN +
- FCS_LEN)) {
- pr_debug(
- "ray_cs invalid packet length %d received\n",
- rx_len);
- return;
- }
- }
+ /* TBD length needs fixing for translated header */
+ if (!sniffer && (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) ||
+ rx_len > (dev->mtu + RX_MAC_HEADER_LENGTH +
+ ETH_HLEN + FCS_LEN))) {
+ pr_debug("ray_cs invalid packet length %d received\n", rx_len);
+ return;
}
pr_debug("ray_cs rx_data packet\n");
/* If fragmented packet, verify sizes of fragments add up */
--
2.39.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] wifi: ray_cs: Remove unnecessary conditional statements
2023-06-27 2:42 [PATCH v2] wifi: ray_cs: Remove unnecessary conditional statements You Kangren
@ 2023-06-30 14:01 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2023-06-30 14:01 UTC (permalink / raw)
To: You Kangren
Cc: Kalle Valo, Dongliang Mu, Christophe JAILLET,
open list:RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER, open list,
opensource.kernel
On Tue, Jun 27, 2023 at 10:42:07AM +0800, You Kangren wrote:
> Remove unnecessary conditional statements to simplify the code
>
> Signed-off-by: You Kangren <youkangren@vivo.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-30 14:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27 2:42 [PATCH v2] wifi: ray_cs: Remove unnecessary conditional statements You Kangren
2023-06-30 14:01 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®