From: Philipp Hortmann Date: Tue, 12 Sep 2023 19:28:53 +0000 (+0200) Subject: staging: rtl8192e: Remove rtllib_get_payload() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=58806573a76b0e55fb0b5b8c323a948fb1540fd7;p=linux.git staging: rtl8192e: Remove rtllib_get_payload() rtllib_process_action() is only called in one place with management frames. Frame is passed over to rtllib_get_payload() which passes it to rtllib_get_hdrlen(). In rtllib_get_hdrlen() all management frames return with hdrlen = RTLLIB_3ADDR_LEN. Therefore the switch in rtllib_get_payload() is useless and dead code. The condition act == NULL cannot occur and can also be removed. Then rtllib_hdr_2addr is not used anymore and can be removed as well. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/3ef288fb819f50da3eb9291522067babaa57f532.1694546301.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 7dfb93f0590c1..565a6e41b9822 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -692,14 +692,6 @@ struct rtllib_hdr_1addr { u8 payload[]; } __packed; -struct rtllib_hdr_2addr { - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 payload[]; -} __packed; - struct rtllib_hdr_3addr { __le16 frame_ctl; __le16 duration_id; @@ -1781,21 +1773,6 @@ static inline int rtllib_get_hdrlen(u16 fc) return hdrlen; } -static inline u8 *rtllib_get_payload(struct rtllib_hdr *hdr) -{ - switch (rtllib_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { - case RTLLIB_1ADDR_LEN: - return ((struct rtllib_hdr_1addr *)hdr)->payload; - case RTLLIB_2ADDR_LEN: - return ((struct rtllib_hdr_2addr *)hdr)->payload; - case RTLLIB_3ADDR_LEN: - return ((struct rtllib_hdr_3addr *)hdr)->payload; - case RTLLIB_4ADDR_LEN: - return ((struct rtllib_hdr_4addr *)hdr)->payload; - } - return NULL; -} - static inline int rtllib_is_ofdm_rate(u8 rate) { switch (rate & ~RTLLIB_BASIC_RATE_MASK) { diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 5de57331c1cff..904be0ef867f8 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -1921,16 +1921,9 @@ EXPORT_SYMBOL(rtllib_ps_tx_ack); static void rtllib_process_action(struct rtllib_device *ieee, struct sk_buff *skb) { - struct rtllib_hdr_3addr *header = (struct rtllib_hdr_3addr *)skb->data; - u8 *act = rtllib_get_payload((struct rtllib_hdr *)header); + u8 *act = skb->data + RTLLIB_3ADDR_LEN; u8 category = 0; - if (act == NULL) { - netdev_warn(ieee->dev, - "Error getting payload of action frame\n"); - return; - } - category = *act; act++; switch (category) {