mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/4] staging: r8188eu: cleaning up unused variables
@ 2022-10-25 17:06 Kang Minchul
  2022-10-25 17:06 ` [PATCH v3 1/4] staging: r8188eu: remove unnecessary variable in ioctl_linux Kang Minchul
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Kang Minchul @ 2022-10-25 17:06 UTC (permalink / raw)
  To: Larry Finger, Phillip Potter, Pavel Skripkin
  Cc: Greg Kroah-Hartman, linux-staging, linux-kernel, Kang Minchul

This patch series cleans up unused variables in r8188eu
causing coccicheck warnings. 

Difference between this patch and previous patch is that this patch series
include making function rtw_sta_flush in r8188eu/core/rtw_ap.c
into void function.

Kang Minchul (4):
  staging: r8188eu: remove unnecessary variable in ioctl_linux
  staging: r8188eu: remove unnecessary vaiable in rtw_recv
  staging: r8188eu: remove unnecessary variable in rtl8188eu_xmit
  staging: r8188eu: make rtw_sta_flush to void

 drivers/staging/r8188eu/core/rtw_ap.c        | 7 ++-----
 drivers/staging/r8188eu/core/rtw_recv.c      | 3 +--
 drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 3 +--
 drivers/staging/r8188eu/include/rtw_ap.h     | 2 +-
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 +---
 5 files changed, 6 insertions(+), 13 deletions(-)

-- 
2.34.1


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

* [PATCH v3 1/4] staging: r8188eu: remove unnecessary variable in ioctl_linux
  2022-10-25 17:06 [PATCH v3 0/4] staging: r8188eu: cleaning up unused variables Kang Minchul
@ 2022-10-25 17:06 ` Kang Minchul
  2022-10-25 17:06 ` [PATCH v3 2/4] staging: r8188eu: remove unnecessary vaiable in rtw_recv Kang Minchul
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kang Minchul @ 2022-10-25 17:06 UTC (permalink / raw)
  To: Larry Finger, Phillip Potter, Pavel Skripkin
  Cc: Greg Kroah-Hartman, linux-staging, linux-kernel, Kang Minchul

Returning value 0 directly instead of storing it in variable ret.
This commit can prevent cocci warning as follows:

  Unneeded variable: "ret". Return "0" on line 3030

Signed-off-by: Kang Minchul <tegongkang@gmail.com>
---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 2de2e1e32738..5e1ad7733127 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2979,8 +2979,6 @@ static int rtw_p2p_set(struct net_device *dev,
 			       struct iw_request_info *info,
 			       union iwreq_data *wrqu, char *extra)
 {
-	int ret = 0;
-
 	if (!memcmp(extra, "enable =", 7)) {
 		rtw_wext_p2p_enable(dev, info, wrqu, &extra[7]);
 	} else if (!memcmp(extra, "setDN =", 6)) {
@@ -3027,7 +3025,7 @@ static int rtw_p2p_set(struct net_device *dev,
 		rtw_p2p_set_persistent(dev, info, wrqu, &extra[11]);
 	}
 
-	return ret;
+	return 0;
 }
 
 static int rtw_p2p_get2(struct net_device *dev,
-- 
2.34.1


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

* [PATCH v3 2/4] staging: r8188eu: remove unnecessary vaiable in rtw_recv
  2022-10-25 17:06 [PATCH v3 0/4] staging: r8188eu: cleaning up unused variables Kang Minchul
  2022-10-25 17:06 ` [PATCH v3 1/4] staging: r8188eu: remove unnecessary variable in ioctl_linux Kang Minchul
@ 2022-10-25 17:06 ` Kang Minchul
  2022-10-25 17:06 ` [PATCH v3 3/4] staging: r8188eu: remove unnecessary variable in rtl8188eu_xmit Kang Minchul
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kang Minchul @ 2022-10-25 17:06 UTC (permalink / raw)
  To: Larry Finger, Phillip Potter, Pavel Skripkin
  Cc: Greg Kroah-Hartman, linux-staging, linux-kernel, Kang Minchul

Return _SUCCESS directly instead of storing it in a variable.
This can prevent cocci warning as follows:

  Unneeded variable: "ret". Return "_SUCCESS" on line 1516

Signed-off-by: Kang Minchul <tegongkang@gmail.com>
---
v2 -> v3: rollback to v1 because v2 caused error by kernel test robot
v1 -> v2: made amsdu_to_msdu into void function

 drivers/staging/r8188eu/core/rtw_recv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
index bb5c3b3888e0..9e98aea09583 100644
--- a/drivers/staging/r8188eu/core/rtw_recv.c
+++ b/drivers/staging/r8188eu/core/rtw_recv.c
@@ -1415,7 +1415,6 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)
 
 	struct recv_priv *precvpriv = &padapter->recvpriv;
 	struct __queue *pfree_recv_queue = &precvpriv->free_recv_queue;
-	int	ret = _SUCCESS;
 
 	nr_subframes = 0;
 
@@ -1513,7 +1512,7 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)
 	prframe->len = 0;
 	rtw_free_recvframe(prframe, pfree_recv_queue);/* free this recv_frame */
 
-	return ret;
+	return _SUCCESS;
 }
 
 static bool check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num)
-- 
2.34.1


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

* [PATCH v3 3/4] staging: r8188eu: remove unnecessary variable in rtl8188eu_xmit
  2022-10-25 17:06 [PATCH v3 0/4] staging: r8188eu: cleaning up unused variables Kang Minchul
  2022-10-25 17:06 ` [PATCH v3 1/4] staging: r8188eu: remove unnecessary variable in ioctl_linux Kang Minchul
  2022-10-25 17:06 ` [PATCH v3 2/4] staging: r8188eu: remove unnecessary vaiable in rtw_recv Kang Minchul
@ 2022-10-25 17:06 ` Kang Minchul
  2022-10-25 17:06 ` [PATCH v3 4/4] staging: r8188eu: make rtw_sta_flush to void Kang Minchul
  2022-10-25 18:17 ` [PATCH v3 0/4] staging: r8188eu: cleaning up unused variables Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Kang Minchul @ 2022-10-25 17:06 UTC (permalink / raw)
  To: Larry Finger, Phillip Potter, Pavel Skripkin
  Cc: Greg Kroah-Hartman, linux-staging, linux-kernel, Kang Minchul

Return 0 directly instead of storing it in a variable.
This can prevent cocci warning as follows:

  Unneeded variable: "pull". Return "0" on line 298

Signed-off-by: Kang Minchul <tegongkang@gmail.com>
---
 drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
index 8e4a5acc0b18..6d1f56d1f9d7 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
@@ -149,7 +149,6 @@ static void fill_txdesc_phy(struct pkt_attrib *pattrib, __le32 *pdw)
 
 static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bagg_pkt)
 {
-	int	pull = 0;
 	uint	qsel;
 	u8 data_rate, pwr_status, offset;
 	struct adapter		*adapt = pxmitframe->padapter;
@@ -295,7 +294,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag
 	ODM_SetTxAntByTxInfo_88E(&haldata->odmpriv, pmem, pattrib->mac_id);
 
 	rtl8188eu_cal_txdesc_chksum(ptxdesc);
-	return pull;
+	return 0;
 }
 
 /* for non-agg data frame or  management frame */
-- 
2.34.1


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

* [PATCH v3 4/4] staging: r8188eu: make rtw_sta_flush to void
  2022-10-25 17:06 [PATCH v3 0/4] staging: r8188eu: cleaning up unused variables Kang Minchul
                   ` (2 preceding siblings ...)
  2022-10-25 17:06 ` [PATCH v3 3/4] staging: r8188eu: remove unnecessary variable in rtl8188eu_xmit Kang Minchul
@ 2022-10-25 17:06 ` Kang Minchul
  2022-10-25 18:17 ` [PATCH v3 0/4] staging: r8188eu: cleaning up unused variables Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Kang Minchul @ 2022-10-25 17:06 UTC (permalink / raw)
  To: Larry Finger, Phillip Potter, Pavel Skripkin
  Cc: Greg Kroah-Hartman, linux-staging, linux-kernel, Kang Minchul

Make function rtw_sta_flush to void in order to
prevent cocci warning as follows:

  Unneeded variable: "ret". Return "0" on line 1031

Signed-off-by: Kang Minchul <tegongkang@gmail.com>
---
v2 -> v3: made rtw_sta_flush into void function

 drivers/staging/r8188eu/core/rtw_ap.c    | 7 ++-----
 drivers/staging/r8188eu/include/rtw_ap.h | 2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c
index 24eb8dce9bfe..e0ca4b6e17cc 100644
--- a/drivers/staging/r8188eu/core/rtw_ap.c
+++ b/drivers/staging/r8188eu/core/rtw_ap.c
@@ -1017,10 +1017,9 @@ u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta,
 	return beacon_updated;
 }
 
-int rtw_sta_flush(struct adapter *padapter)
+void rtw_sta_flush(struct adapter *padapter)
 {
 	struct list_head *phead, *plist;
-	int ret = 0;
 	struct sta_info *psta = NULL;
 	struct sta_priv *pstapriv = &padapter->stapriv;
 	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -1028,7 +1027,7 @@ int rtw_sta_flush(struct adapter *padapter)
 	u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 
 	if ((pmlmeinfo->state & 0x03) != WIFI_FW_AP_STATE)
-		return ret;
+		return;
 
 	spin_lock_bh(&pstapriv->asoc_list_lock);
 	phead = &pstapriv->asoc_list;
@@ -1050,8 +1049,6 @@ int rtw_sta_flush(struct adapter *padapter)
 	issue_deauth(padapter, bc_addr, WLAN_REASON_DEAUTH_LEAVING);
 
 	associated_clients_update(padapter, true);
-
-	return ret;
 }
 
 /* called > TSR LEVEL for USB or SDIO Interface*/
diff --git a/drivers/staging/r8188eu/include/rtw_ap.h b/drivers/staging/r8188eu/include/rtw_ap.h
index 8b4134eb3095..89b02c97e041 100644
--- a/drivers/staging/r8188eu/include/rtw_ap.h
+++ b/drivers/staging/r8188eu/include/rtw_ap.h
@@ -26,7 +26,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta);
 void sta_info_update(struct adapter *padapter, struct sta_info *psta);
 u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta,
 	       bool active, u16 reason);
-int rtw_sta_flush(struct adapter *padapter);
+void rtw_sta_flush(struct adapter *padapter);
 void start_ap_mode(struct adapter *padapter);
 void stop_ap_mode(struct adapter *padapter);
 void update_bmc_sta(struct adapter *padapter);
-- 
2.34.1


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

* Re: [PATCH v3 0/4] staging: r8188eu: cleaning up unused variables
  2022-10-25 17:06 [PATCH v3 0/4] staging: r8188eu: cleaning up unused variables Kang Minchul
                   ` (3 preceding siblings ...)
  2022-10-25 17:06 ` [PATCH v3 4/4] staging: r8188eu: make rtw_sta_flush to void Kang Minchul
@ 2022-10-25 18:17 ` Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Philipp Hortmann @ 2022-10-25 18:17 UTC (permalink / raw)
  To: Kang Minchul, Larry Finger, Phillip Potter, Pavel Skripkin
  Cc: Greg Kroah-Hartman, linux-staging, linux-kernel

On 10/25/22 19:06, Kang Minchul wrote:
> This patch series cleans up unused variables in r8188eu
> causing coccicheck warnings.
> 
> Difference between this patch and previous patch is that this patch series
> include making function rtw_sta_flush in r8188eu/core/rtw_ap.c
> into void function.
> 
> Kang Minchul (4):
>    staging: r8188eu: remove unnecessary variable in ioctl_linux
>    staging: r8188eu: remove unnecessary vaiable in rtw_recv
>    staging: r8188eu: remove unnecessary variable in rtl8188eu_xmit
>    staging: r8188eu: make rtw_sta_flush to void
> 
>   drivers/staging/r8188eu/core/rtw_ap.c        | 7 ++-----
>   drivers/staging/r8188eu/core/rtw_recv.c      | 3 +--
>   drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 3 +--
>   drivers/staging/r8188eu/include/rtw_ap.h     | 2 +-
>   drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 +---
>   5 files changed, 6 insertions(+), 13 deletions(-)
> 
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150

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

end of thread, other threads:[~2022-10-25 18:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 17:06 [PATCH v3 0/4] staging: r8188eu: cleaning up unused variables Kang Minchul
2022-10-25 17:06 ` [PATCH v3 1/4] staging: r8188eu: remove unnecessary variable in ioctl_linux Kang Minchul
2022-10-25 17:06 ` [PATCH v3 2/4] staging: r8188eu: remove unnecessary vaiable in rtw_recv Kang Minchul
2022-10-25 17:06 ` [PATCH v3 3/4] staging: r8188eu: remove unnecessary variable in rtl8188eu_xmit Kang Minchul
2022-10-25 17:06 ` [PATCH v3 4/4] staging: r8188eu: make rtw_sta_flush to void Kang Minchul
2022-10-25 18:17 ` [PATCH v3 0/4] staging: r8188eu: cleaning up unused variables Philipp Hortmann

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®