Hi all,
Commit 987219ad34a6 ("staging: r8188eu: remove lines from Makefile that
silence build warnings") exposed some instances of -Wuninitialized in
this driver. This series cleans them up. This passes my build tests with
GCC and clang against x86_64 allmodconfig.
Cheers,
Nathan
Nathan Chancellor (3):
staging: r8188eu: Remove unused static inline functions in rtw_recv.h
staging: r8188eu: Remove uninitialized use of ether_type in portctrl()
staging: r8188eu: Reorganize error handling in rtw_drv_init()
drivers/staging/r8188eu/core/rtw_recv.c | 4 --
drivers/staging/r8188eu/include/rtw_recv.h | 46 ----------------------
drivers/staging/r8188eu/os_dep/usb_intf.c | 20 +++++-----
3 files changed, 10 insertions(+), 60 deletions(-)
base-commit: 626520f4ba27d92c8caaf2d1f70c4bca4ea3f9de
--
2.33.0.rc2
After commit 987219ad34a6 ("staging: r8188eu: remove lines from Makefile
that silence build warnings"), clang warns:
drivers/staging/r8188eu/core/rtw_recv.c:499:8: warning: variable
'ether_type' is uninitialized when used here [-Wuninitialized]
if (ether_type == eapol_type)
^~~~~~~~~~
drivers/staging/r8188eu/core/rtw_recv.c:458:16: note: initialize the
variable 'ether_type' to silence this warning
u16 ether_type;
^
= 0
1 warning generated.
This if statement sets the exact same assignment as above so just remove
it.
Signed-off-by: Nathan Chancellor <[email protected]>
---
drivers/staging/r8188eu/core/rtw_recv.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
index 9b3637e49052..8df38db9572c 100644
--- a/drivers/staging/r8188eu/core/rtw_recv.c
+++ b/drivers/staging/r8188eu/core/rtw_recv.c
@@ -495,10 +495,6 @@ static struct recv_frame *portctrl(struct adapter *adapter, struct recv_frame *p
/* allowed */
/* check decryption status, and decrypt the frame if needed */
prtnframe = precv_frame;
- /* check is the EAPOL frame or not (Rekey) */
- if (ether_type == eapol_type)
- /* check Rekey */
- prtnframe = precv_frame;
}
} else {
prtnframe = precv_frame;
--
2.33.0.rc2
After commit 987219ad34a6 ("staging: r8188eu: remove lines from Makefile
that silence build warnings"), clang warns several times:
In file included from
drivers/staging/r8188eu/os_dep/../include/drv_types.h:22:
drivers/staging/r8188eu/os_dep/../include/rtw_recv.h:395:9: warning:
variable 'buf_desc' is uninitialized when used here [-Wuninitialized]
return buf_desc;
^~~~~~~~
drivers/staging/r8188eu/os_dep/../include/rtw_recv.h:391:25: note:
initialize the variable 'buf_desc' to silence this warning
unsigned char *buf_desc;
^
= NULL
drivers/staging/r8188eu/os_dep/../include/rtw_recv.h:412:52: warning:
variable 'buf_star' is uninitialized when used here [-Wuninitialized]
precv_frame = rxmem_to_recvframe((unsigned char *)buf_star);
^~~~~~~~
drivers/staging/r8188eu/os_dep/../include/rtw_recv.h:410:14: note:
initialize the variable 'buf_star' to silence this warning
u8 *buf_star;
^
= NULL
2 warnings generated.
The functions that these warnings come from are not used or are called
from functions that are not used so just remove them to remove the
warnings.
Signed-off-by: Nathan Chancellor <[email protected]>
---
drivers/staging/r8188eu/include/rtw_recv.h | 46 ----------------------
1 file changed, 46 deletions(-)
diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h
index 857269ae4209..81594e7aed51 100644
--- a/drivers/staging/r8188eu/include/rtw_recv.h
+++ b/drivers/staging/r8188eu/include/rtw_recv.h
@@ -386,52 +386,6 @@ static inline u8 *recvframe_pull_tail(struct recv_frame *precvframe, int sz)
return precvframe->rx_tail;
}
-static inline unsigned char *get_rxbuf_desc(struct recv_frame *precvframe)
-{
- unsigned char *buf_desc;
-
- if (precvframe == NULL)
- return NULL;
- return buf_desc;
-}
-
-static inline struct recv_frame *rxmem_to_recvframe(u8 *rxmem)
-{
- /* due to the design of 2048 bytes alignment of recv_frame,
- * we can reference the struct recv_frame */
- /* from any given member of recv_frame. */
- /* rxmem indicates the any member/address in recv_frame */
-
- return (struct recv_frame *)(((size_t)rxmem >> RXFRAME_ALIGN) << RXFRAME_ALIGN);
-}
-
-static inline struct recv_frame *pkt_to_recvframe(struct sk_buff *pkt)
-{
- u8 *buf_star;
- struct recv_frame *precv_frame;
- precv_frame = rxmem_to_recvframe((unsigned char *)buf_star);
-
- return precv_frame;
-}
-
-static inline u8 *pkt_to_recvmem(struct sk_buff *pkt)
-{
- /* return the rx_head */
-
- struct recv_frame *precv_frame = pkt_to_recvframe(pkt);
-
- return precv_frame->rx_head;
-}
-
-static inline u8 *pkt_to_recvdata(struct sk_buff *pkt)
-{
- /* return the rx_data */
-
- struct recv_frame *precv_frame = pkt_to_recvframe(pkt);
-
- return precv_frame->rx_data;
-}
-
static inline int get_recvframe_len(struct recv_frame *precvframe)
{
return precvframe->len;
--
2.33.0.rc2
On Thu, 12 Aug 2021 at 21:40, Nathan Chancellor <[email protected]> wrote:
>
> After commit 987219ad34a6 ("staging: r8188eu: remove lines from Makefile
> that silence build warnings"), clang warns several times:
>
> In file included from
> drivers/staging/r8188eu/os_dep/../include/drv_types.h:22:
> drivers/staging/r8188eu/os_dep/../include/rtw_recv.h:395:9: warning:
> variable 'buf_desc' is uninitialized when used here [-Wuninitialized]
> return buf_desc;
> ^~~~~~~~
> drivers/staging/r8188eu/os_dep/../include/rtw_recv.h:391:25: note:
> initialize the variable 'buf_desc' to silence this warning
> unsigned char *buf_desc;
> ^
> = NULL
> drivers/staging/r8188eu/os_dep/../include/rtw_recv.h:412:52: warning:
> variable 'buf_star' is uninitialized when used here [-Wuninitialized]
> precv_frame = rxmem_to_recvframe((unsigned char *)buf_star);
> ^~~~~~~~
> drivers/staging/r8188eu/os_dep/../include/rtw_recv.h:410:14: note:
> initialize the variable 'buf_star' to silence this warning
> u8 *buf_star;
> ^
> = NULL
> 2 warnings generated.
>
> The functions that these warnings come from are not used or are called
> from functions that are not used so just remove them to remove the
> warnings.
>
> Signed-off-by: Nathan Chancellor <[email protected]>
> ---
> drivers/staging/r8188eu/include/rtw_recv.h | 46 ----------------------
> 1 file changed, 46 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h
> index 857269ae4209..81594e7aed51 100644
> --- a/drivers/staging/r8188eu/include/rtw_recv.h
> +++ b/drivers/staging/r8188eu/include/rtw_recv.h
> @@ -386,52 +386,6 @@ static inline u8 *recvframe_pull_tail(struct recv_frame *precvframe, int sz)
> return precvframe->rx_tail;
> }
>
> -static inline unsigned char *get_rxbuf_desc(struct recv_frame *precvframe)
> -{
> - unsigned char *buf_desc;
> -
> - if (precvframe == NULL)
> - return NULL;
> - return buf_desc;
> -}
> -
> -static inline struct recv_frame *rxmem_to_recvframe(u8 *rxmem)
> -{
> - /* due to the design of 2048 bytes alignment of recv_frame,
> - * we can reference the struct recv_frame */
> - /* from any given member of recv_frame. */
> - /* rxmem indicates the any member/address in recv_frame */
> -
> - return (struct recv_frame *)(((size_t)rxmem >> RXFRAME_ALIGN) << RXFRAME_ALIGN);
> -}
> -
> -static inline struct recv_frame *pkt_to_recvframe(struct sk_buff *pkt)
> -{
> - u8 *buf_star;
> - struct recv_frame *precv_frame;
> - precv_frame = rxmem_to_recvframe((unsigned char *)buf_star);
> -
> - return precv_frame;
> -}
> -
> -static inline u8 *pkt_to_recvmem(struct sk_buff *pkt)
> -{
> - /* return the rx_head */
> -
> - struct recv_frame *precv_frame = pkt_to_recvframe(pkt);
> -
> - return precv_frame->rx_head;
> -}
> -
> -static inline u8 *pkt_to_recvdata(struct sk_buff *pkt)
> -{
> - /* return the rx_data */
> -
> - struct recv_frame *precv_frame = pkt_to_recvframe(pkt);
> -
> - return precv_frame->rx_data;
> -}
> -
> static inline int get_recvframe_len(struct recv_frame *precvframe)
> {
> return precvframe->len;
> --
> 2.33.0.rc2
>
Dear Nathan,
Thanks for this.
Acked-by: Phillip Potter <[email protected]>
Regards,
Phil