staging: rtl8192e: Remove rtllib_get_payload()
authorPhilipp Hortmann <philipp.g.hortmann@gmail.com>
Tue, 12 Sep 2023 19:28:53 +0000 (21:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Sep 2023 07:47:42 +0000 (09:47 +0200)
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 <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/3ef288fb819f50da3eb9291522067babaa57f532.1694546301.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192e/rtllib.h
drivers/staging/rtl8192e/rtllib_softmac.c

index 7dfb93f0590c104e61a78bddb9c1cd047ee7afbe..565a6e41b98223e7d5a05f958119804c31874770 100644 (file)
@@ -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) {
index 5de57331c1cffca0fe76ee27bd23d4ebac3d0ee3..904be0ef867f820ef613d46905053c9a40986b7d 100644 (file)
@@ -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) {