2022-02-01 02:30:11

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 00/23] staging: r8188eu: remove unneeded ret variables

This patchset does the following to functions in ioctl_linux.c:
- Remove unneeded return variable in some functions.
These functions cannot be converted to void either because it is an
iw_handler function or the function does return error code.
- Propagate error code in rtw_p2p_get2 function
- Convert some functions that always return 0 to return void

v3 -> v4:
- Split the changes into smaller patches to make it easier to review
- Add a new patch to propagate error code in rtw_p2p_get2 function

v2 -> v3:
- Remove returns at the end of void functions to conform to coding style

v1 -> v2:
- As suggested by Greg, change functions that always return 0
and whose return value is not used, to return void instead.
- Not removing return variables in rtw_p2p_get2 and rtw_p2p_set
as they may need to be used.

Abdun Nihaal (23):
staging: r8188eu: remove unneeded variable in rtw_wx_get_essid
staging: r8188eu: remove unneeded variable in rtw_wx_get_enc
staging: r8188eu: remove unneeded variable in rtw_p2p_get
staging: r8188eu: remove unneeded variable in
rtw_p2p_get_wps_configmethod
staging: r8188eu: remove unneeded variable in
rtw_p2p_get_go_device_address
staging: r8188eu: remove unneeded variable in rtw_p2p_get_device_type
staging: r8188eu: remove unneeded variable in rtw_p2p_get_device_name
staging: r8188eu: remove unneeded variable in
rtw_p2p_get_invitation_procedure
staging: r8188eu: propagate error code in rtw_p2p_get2
staging: r8188eu: convert rtw_p2p_set_go_nego_ssid to return void
staging: r8188eu: convert rtw_p2p_setDN to return void
staging: r8188eu: convert rtw_p2p_get_status to return void
staging: r8188eu: convert rtw_p2p_get_req_cm to return void
staging: r8188eu: convert rtw_p2p_get_role to return void
staging: r8188eu: convert rtw_p2p_get_peer_ifaddr to return void
staging: r8188eu: convert rtw_p2p_get_peer_devaddr to return void
staging: r8188eu: convert rtw_p2p_get_peer_devaddr_by_invitation to
return void
staging: r8188eu: convert rtw_p2p_get_groupid to return void
staging: r8188eu: convert rtw_p2p_get_op_ch to return void
staging: r8188eu: convert rtw_p2p_invite_req to return void
staging: r8188eu: convert rtw_p2p_set_persistent to return void
staging: r8188eu: convert rtw_p2p_prov_disc to return void
staging: r8188eu: convert rtw_p2p_got_wpsinfo to return void

drivers/staging/r8188eu/os_dep/ioctl_linux.c | 155 +++++++------------
1 file changed, 59 insertions(+), 96 deletions(-)

--
2.34.1


2022-02-01 02:30:27

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 01/23] staging: r8188eu: remove unneeded variable in rtw_wx_get_essid

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index b9f9698d70cf..3a60e1f81592 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -1383,7 +1383,7 @@ static int rtw_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
- u32 len, ret = 0;
+ u32 len;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;
@@ -1399,7 +1399,7 @@ static int rtw_wx_get_essid(struct net_device *dev,
wrqu->essid.length = len;
wrqu->essid.flags = 1;

- return ret;
+ return 0;
}

static int rtw_wx_set_rate(struct net_device *dev,
--
2.34.1

2022-02-01 02:32:11

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 02/23] staging: r8188eu: remove unneeded variable in rtw_wx_get_enc

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 3a60e1f81592..f99942417a71 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -1717,7 +1717,7 @@ static int rtw_wx_get_enc(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
- uint key, ret = 0;
+ uint key;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct iw_point *erq = &wrqu->encoding;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -1778,7 +1778,7 @@ static int rtw_wx_get_enc(struct net_device *dev,
}


- return ret;
+ return 0;
}

static int rtw_wx_get_power(struct net_device *dev,
--
2.34.1

2022-02-01 02:43:48

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 03/23] staging: r8188eu: remove unneeded variable in rtw_p2p_get

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle
Signed-off-by: Abdun Nihaal <[email protected]>
---
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 f99942417a71..bc5c8454ebcf 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -3422,8 +3422,6 @@ static int rtw_p2p_get(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
-
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);

if (padapter->bShowGetP2PState)
@@ -3447,7 +3445,7 @@ static int rtw_p2p_get(struct net_device *dev,
} else if (!memcmp(wrqu->data.pointer, "op_ch", 5)) {
rtw_p2p_get_op_ch(dev, info, wrqu, extra);
}
- return ret;
+ return 0;
}

static int rtw_p2p_get2(struct net_device *dev,
--
2.34.1

2022-02-01 02:44:17

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 04/23] staging: r8188eu: remove unneeded variable in rtw_p2p_get_wps_configmethod

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index bc5c8454ebcf..b0f78673d9b7 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2620,7 +2620,6 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
u8 peerMAC[ETH_ALEN] = {0x00};
int jj, kk;
@@ -2681,7 +2680,7 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev,

if (copy_to_user(wrqu->data.pointer, attr_content_str, 6 + 17))
return -EFAULT;
- return ret;
+ return 0;
}

static int rtw_p2p_get_go_device_address(struct net_device *dev,
--
2.34.1

2022-02-01 02:45:36

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 06/23] staging: r8188eu: remove unneeded variable in rtw_p2p_get_device_type

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index b093430ff744..6d72b15541ab 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2769,7 +2769,6 @@ static int rtw_p2p_get_device_type(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
u8 peerMAC[ETH_ALEN] = {0x00};
int jj, kk;
@@ -2838,7 +2837,7 @@ static int rtw_p2p_get_device_type(struct net_device *dev,
return -EFAULT;
}

- return ret;
+ return 0;
}

static int rtw_p2p_get_device_name(struct net_device *dev,
--
2.34.1

2022-02-01 02:46:01

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 08/23] staging: r8188eu: remove unneeded variable in rtw_p2p_get_invitation_procedure

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 33fe8e944df4..35f7ba66a7cf 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2909,7 +2909,6 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
u8 peerMAC[ETH_ALEN] = {0x00};
int jj, kk;
@@ -2978,7 +2977,7 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev,
}
if (copy_to_user(wrqu->data.pointer, inv_proc_str, 8 + 17))
return -EFAULT;
- return ret;
+ return 0;
}

static int rtw_p2p_connect(struct net_device *dev,
--
2.34.1

2022-02-01 02:46:47

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 05/23] staging: r8188eu: remove unneeded variable in rtw_p2p_get_go_device_address

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index b0f78673d9b7..b093430ff744 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2687,7 +2687,6 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
u8 peerMAC[ETH_ALEN] = {0x00};
int jj, kk;
@@ -2763,7 +2762,7 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev,

if (copy_to_user(wrqu->data.pointer, go_devadd_str, 10 + 17))
return -EFAULT;
- return ret;
+ return 0;
}

static int rtw_p2p_get_device_type(struct net_device *dev,
--
2.34.1

2022-02-01 02:47:20

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 09/23] staging: r8188eu: propagate error code in rtw_p2p_get2

rtw_p2p_get2 calls functions that can fail with -EFAULT.
Return the error code from the called functions.

Signed-off-by: Abdun Nihaal <[email protected]>
---
- Newly added in V4

drivers/staging/r8188eu/os_dep/ioctl_linux.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 35f7ba66a7cf..99c7f9369d2a 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -3452,19 +3452,19 @@ static int rtw_p2p_get2(struct net_device *dev,
DBG_88E("[%s] extra = %s\n", __func__, (char *)wrqu->data.pointer);
if (!memcmp(extra, "wpsCM =", 6)) {
wrqu->data.length -= 6;
- rtw_p2p_get_wps_configmethod(dev, info, wrqu, &extra[6]);
+ ret = rtw_p2p_get_wps_configmethod(dev, info, wrqu, &extra[6]);
} else if (!memcmp(extra, "devN =", 5)) {
wrqu->data.length -= 5;
- rtw_p2p_get_device_name(dev, info, wrqu, &extra[5]);
+ ret = rtw_p2p_get_device_name(dev, info, wrqu, &extra[5]);
} else if (!memcmp(extra, "dev_type =", 9)) {
wrqu->data.length -= 9;
- rtw_p2p_get_device_type(dev, info, wrqu, &extra[9]);
+ ret = rtw_p2p_get_device_type(dev, info, wrqu, &extra[9]);
} else if (!memcmp(extra, "go_devadd =", 10)) {
wrqu->data.length -= 10;
- rtw_p2p_get_go_device_address(dev, info, wrqu, &extra[10]);
+ ret = rtw_p2p_get_go_device_address(dev, info, wrqu, &extra[10]);
} else if (!memcmp(extra, "InvProc =", 8)) {
wrqu->data.length -= 8;
- rtw_p2p_get_invitation_procedure(dev, info, wrqu, &extra[8]);
+ ret = rtw_p2p_get_invitation_procedure(dev, info, wrqu, &extra[8]);
}

return ret;
--
2.34.1

2022-02-01 02:47:54

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 07/23] staging: r8188eu: remove unneeded variable in rtw_p2p_get_device_name

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 6d72b15541ab..33fe8e944df4 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2844,7 +2844,6 @@ static int rtw_p2p_get_device_name(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
u8 peerMAC[ETH_ALEN] = {0x00};
int jj, kk;
@@ -2903,7 +2902,7 @@ static int rtw_p2p_get_device_name(struct net_device *dev,

if (copy_to_user(wrqu->data.pointer, dev_name_str, 5 + ((dev_len > 17) ? dev_len : 17)))
return -EFAULT;
- return ret;
+ return 0;
}

static int rtw_p2p_get_invitation_procedure(struct net_device *dev,
--
2.34.1

2022-02-01 02:48:05

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 10/23] staging: r8188eu: convert rtw_p2p_set_go_nego_ssid to return void

rtw_p2p_set_go_nego_ssid always returns 0 and it's return value is not
used. Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 99c7f9369d2a..c761c06cf6e8 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2308,19 +2308,16 @@ static int rtw_wext_p2p_enable(struct net_device *dev,
return ret;
}

-static int rtw_p2p_set_go_nego_ssid(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static void rtw_p2p_set_go_nego_ssid(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;

DBG_88E("[%s] ssid = %s, len = %zu\n", __func__, extra, strlen(extra));
memcpy(pwdinfo->nego_ssid, extra, strlen(extra));
pwdinfo->nego_ssidlen = strlen(extra);
-
- return ret;
}

static int rtw_p2p_set_intent(struct net_device *dev,
--
2.34.1

2022-02-01 02:50:21

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 11/23] staging: r8188eu: convert rtw_p2p_setDN to return void

rtw_p2p_setDN always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index c761c06cf6e8..daaf808ca23e 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2453,11 +2453,10 @@ static int rtw_p2p_profilefound(struct net_device *dev,
return ret;
}

-static int rtw_p2p_setDN(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static void rtw_p2p_setDN(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;

@@ -2465,8 +2464,6 @@ static int rtw_p2p_setDN(struct net_device *dev,
memset(pwdinfo->device_name, 0x00, WPS_MAX_DEVICE_NAME_LEN);
memcpy(pwdinfo->device_name, extra, wrqu->data.length - 1);
pwdinfo->device_name_len = wrqu->data.length - 1;
-
- return ret;
}

static int rtw_p2p_get_status(struct net_device *dev,
--
2.34.1

2022-02-01 02:53:35

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 12/23] staging: r8188eu: convert rtw_p2p_get_status to return void

rtw_p2p_get_status always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index daaf808ca23e..d2db2117abc3 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2466,11 +2466,10 @@ static void rtw_p2p_setDN(struct net_device *dev,
pwdinfo->device_name_len = wrqu->data.length - 1;
}

-static int rtw_p2p_get_status(struct net_device *dev,
+static void rtw_p2p_get_status(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;

@@ -2484,8 +2483,6 @@ static int rtw_p2p_get_status(struct net_device *dev,
/* About the "Role" information, we will use the new private IOCTL to get the "Role" information. */
sprintf(extra, "\n\nStatus =%.2d\n", rtw_p2p_state(pwdinfo));
wrqu->data.length = strlen(extra);
-
- return ret;
}

/* Commented by Albert 20110520 */
--
2.34.1

2022-02-01 02:54:28

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 13/23] staging: r8188eu: convert rtw_p2p_get_req_cm to return void

rtw_p2p_get_req_cm always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
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 d2db2117abc3..ba0f42ca36e3 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2490,17 +2490,15 @@ static void rtw_p2p_get_status(struct net_device *dev,
/* This config method description will show us which config method the remote P2P device is intended to use */
/* by sending the provisioning discovery request frame. */

-static int rtw_p2p_get_req_cm(struct net_device *dev,
+static void rtw_p2p_get_req_cm(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;

sprintf(extra, "\n\nCM =%s\n", pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req);
wrqu->data.length = strlen(extra);
- return ret;
}

static int rtw_p2p_get_role(struct net_device *dev,
--
2.34.1

2022-02-01 02:58:09

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 14/23] staging: r8188eu: convert rtw_p2p_get_role to return void

rtw_p2p_get_role always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index ba0f42ca36e3..343b4ad6ce65 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2501,11 +2501,10 @@ static void rtw_p2p_get_req_cm(struct net_device *dev,
wrqu->data.length = strlen(extra);
}

-static int rtw_p2p_get_role(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static void rtw_p2p_get_role(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;

@@ -2515,7 +2514,6 @@ static int rtw_p2p_get_role(struct net_device *dev,

sprintf(extra, "\n\nRole =%.2d\n", rtw_p2p_role(pwdinfo));
wrqu->data.length = strlen(extra);
- return ret;
}

static int rtw_p2p_get_peer_ifaddr(struct net_device *dev,
--
2.34.1

2022-02-01 03:01:42

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 15/23] staging: r8188eu: convert rtw_p2p_get_peer_ifaddr to return void

rtw_p2p_get_peer_ifaddr always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 343b4ad6ce65..1f89f4fe4d8e 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2516,11 +2516,10 @@ static void rtw_p2p_get_role(struct net_device *dev,
wrqu->data.length = strlen(extra);
}

-static int rtw_p2p_get_peer_ifaddr(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static void rtw_p2p_get_peer_ifaddr(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;

@@ -2530,7 +2529,6 @@ static int rtw_p2p_get_peer_ifaddr(struct net_device *dev,
sprintf(extra, "\nMAC %pM",
pwdinfo->p2p_peer_interface_addr);
wrqu->data.length = strlen(extra);
- return ret;
}

static int rtw_p2p_get_peer_devaddr(struct net_device *dev,
--
2.34.1

2022-02-01 03:03:27

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 16/23] staging: r8188eu: convert rtw_p2p_get_peer_devaddr to return void

rtw_p2p_get_peer_devaddr always returns 0 and it's return value is not
used. Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 1f89f4fe4d8e..dfd19a649803 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2531,12 +2531,11 @@ static void rtw_p2p_get_peer_ifaddr(struct net_device *dev,
wrqu->data.length = strlen(extra);
}

-static int rtw_p2p_get_peer_devaddr(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static void rtw_p2p_get_peer_devaddr(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)

{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;

@@ -2546,7 +2545,6 @@ static int rtw_p2p_get_peer_devaddr(struct net_device *dev,
sprintf(extra, "\n%pM",
pwdinfo->rx_prov_disc_info.peerDevAddr);
wrqu->data.length = strlen(extra);
- return ret;
}

static int rtw_p2p_get_peer_devaddr_by_invitation(struct net_device *dev,
--
2.34.1

2022-02-01 03:04:41

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 17/23] staging: r8188eu: convert rtw_p2p_get_peer_devaddr_by_invitation to return void

rtw_p2p_get_peer_devaddr_by_invitation always returns 0 and it's return
value is not used. Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index dfd19a649803..9ee647de5ba7 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2547,12 +2547,12 @@ static void rtw_p2p_get_peer_devaddr(struct net_device *dev,
wrqu->data.length = strlen(extra);
}

-static int rtw_p2p_get_peer_devaddr_by_invitation(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static void rtw_p2p_get_peer_devaddr_by_invitation(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)

{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;

@@ -2562,7 +2562,6 @@ static int rtw_p2p_get_peer_devaddr_by_invitation(struct net_device *dev,
sprintf(extra, "\nMAC %pM",
pwdinfo->p2p_peer_device_addr);
wrqu->data.length = strlen(extra);
- return ret;
}

static int rtw_p2p_get_groupid(struct net_device *dev,
--
2.34.1

2022-02-01 03:05:20

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 18/23] staging: r8188eu: convert rtw_p2p_get_groupid to return void

rtw_p2p_get_groupid always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 9ee647de5ba7..4c47e9bb7fc3 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2564,12 +2564,11 @@ static void rtw_p2p_get_peer_devaddr_by_invitation(struct net_device *dev,
wrqu->data.length = strlen(extra);
}

-static int rtw_p2p_get_groupid(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static void rtw_p2p_get_groupid(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)

{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;

@@ -2579,7 +2578,6 @@ static int rtw_p2p_get_groupid(struct net_device *dev,
pwdinfo->groupid_info.go_device_addr[4], pwdinfo->groupid_info.go_device_addr[5],
pwdinfo->groupid_info.ssid);
wrqu->data.length = strlen(extra);
- return ret;
}

static int rtw_p2p_get_op_ch(struct net_device *dev,
--
2.34.1

2022-02-01 03:06:13

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 20/23] staging: r8188eu: convert rtw_p2p_invite_req to return void

rtw_p2p_invite_req always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index f533f709ead5..6375b3776168 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -3037,11 +3037,10 @@ static int rtw_p2p_connect(struct net_device *dev,
return ret;
}

-static int rtw_p2p_invite_req(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static void rtw_p2p_invite_req(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
int jj, kk;
@@ -3065,12 +3064,12 @@ static int rtw_p2p_invite_req(struct net_device *dev,

if (wrqu->data.length <= 37) {
DBG_88E("[%s] Wrong format!\n", __func__);
- return ret;
+ return;
}

if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) {
DBG_88E("[%s] WiFi Direct is disable!\n", __func__);
- return ret;
+ return;
} else {
/* Reset the content of struct tx_invite_req_info */
pinvite_req_info->benable = false;
@@ -3143,7 +3142,6 @@ static int rtw_p2p_invite_req(struct net_device *dev,
} else {
DBG_88E("[%s] NOT Found in the Scanning Queue!\n", __func__);
}
- return ret;
}

static int rtw_p2p_set_persistent(struct net_device *dev,
--
2.34.1

2022-02-01 03:07:29

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 23/23] staging: r8188eu: convert rtw_p2p_got_wpsinfo to return void

rtw_p2p_got_wpsinfo always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 1af8b2c068b8..c54ec5602ddf 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -3301,11 +3301,10 @@ static void rtw_p2p_prov_disc(struct net_device *dev,
/* This function is used to inform the driver the user had specified the pin code value or pbc */
/* to application. */

-static int rtw_p2p_got_wpsinfo(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static void rtw_p2p_got_wpsinfo(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;

@@ -3326,7 +3325,6 @@ static int rtw_p2p_got_wpsinfo(struct net_device *dev,
pwdinfo->ui_got_wps_info = P2P_GOT_WPSINFO_PBC;
else
pwdinfo->ui_got_wps_info = P2P_NO_WPSINFO;
- return ret;
}

static int rtw_p2p_set(struct net_device *dev,
--
2.34.1

2022-02-01 03:07:31

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 21/23] staging: r8188eu: convert rtw_p2p_set_persistent to return void

rtw_p2p_set_persistent always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 6375b3776168..4c778cf92680 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -3144,11 +3144,10 @@ static void rtw_p2p_invite_req(struct net_device *dev,
}
}

-static int rtw_p2p_set_persistent(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static void rtw_p2p_set_persistent(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;

@@ -3160,7 +3159,7 @@ static int rtw_p2p_set_persistent(struct net_device *dev,

if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) {
DBG_88E("[%s] WiFi Direct is disable!\n", __func__);
- return ret;
+ return;
} else {
if (extra[0] == '0') /* Disable the persistent group function. */
pwdinfo->persistent_supported = false;
@@ -3170,7 +3169,6 @@ static int rtw_p2p_set_persistent(struct net_device *dev,
pwdinfo->persistent_supported = false;
}
pr_info("[%s] persistent_supported = %d\n", __func__, pwdinfo->persistent_supported);
- return ret;
}

static int rtw_p2p_prov_disc(struct net_device *dev,
--
2.34.1

2022-02-01 03:07:43

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 22/23] staging: r8188eu: convert rtw_p2p_prov_disc to return void

rtw_p2p_prov_disc always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 4c778cf92680..1af8b2c068b8 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -3171,11 +3171,10 @@ static void rtw_p2p_set_persistent(struct net_device *dev,
pr_info("[%s] persistent_supported = %d\n", __func__, pwdinfo->persistent_supported);
}

-static int rtw_p2p_prov_disc(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static void rtw_p2p_prov_disc(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
u8 peerMAC[ETH_ALEN] = {0x00};
@@ -3201,7 +3200,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev,

if (pwdinfo->p2p_state == P2P_STATE_NONE) {
DBG_88E("[%s] WiFi Direct is disable!\n", __func__);
- return ret;
+ return;
} else {
/* Reset the content of struct tx_provdisc_req_info excluded the wps_config_method_request. */
memset(pwdinfo->tx_prov_disc_info.peerDevAddr, 0x00, ETH_ALEN);
@@ -3225,7 +3224,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev,
pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_LABEL;
} else {
DBG_88E("[%s] Unknown WPS config methodn", __func__);
- return ret;
+ return;
}

spin_lock_bh(&pmlmepriv->scanned_queue.lock);
@@ -3297,7 +3296,6 @@ static int rtw_p2p_prov_disc(struct net_device *dev,
} else {
DBG_88E("[%s] NOT Found in the Scanning Queue!\n", __func__);
}
- return ret;
}

/* This function is used to inform the driver the user had specified the pin code value or pbc */
--
2.34.1

2022-02-01 03:07:47

by Abdun Nihaal

[permalink] [raw]
Subject: [PATCH v4 19/23] staging: r8188eu: convert rtw_p2p_get_op_ch to return void

rtw_p2p_get_op_ch always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Abdun Nihaal <[email protected]>
---
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 4c47e9bb7fc3..f533f709ead5 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2580,12 +2580,11 @@ static void rtw_p2p_get_groupid(struct net_device *dev,
wrqu->data.length = strlen(extra);
}

-static int rtw_p2p_get_op_ch(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static void rtw_p2p_get_op_ch(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)

{
- int ret = 0;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo = &padapter->wdinfo;

@@ -2593,7 +2592,6 @@ static int rtw_p2p_get_op_ch(struct net_device *dev,

sprintf(extra, "\n\nOp_ch =%.2d\n", pwdinfo->operating_channel);
wrqu->data.length = strlen(extra);
- return ret;
}

static int rtw_p2p_get_wps_configmethod(struct net_device *dev,
--
2.34.1

2022-02-01 20:17:42

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v4 00/23] staging: r8188eu: remove unneeded ret variables

On Sat, Jan 29, 2022 at 09:34:06PM +0530, Abdun Nihaal wrote:
> This patchset does the following to functions in ioctl_linux.c:
> - Remove unneeded return variable in some functions.
> These functions cannot be converted to void either because it is an
> iw_handler function or the function does return error code.
> - Propagate error code in rtw_p2p_get2 function
> - Convert some functions that always return 0 to return void
>
> v3 -> v4:
> - Split the changes into smaller patches to make it easier to review
> - Add a new patch to propagate error code in rtw_p2p_get2 function

Much nicer and easier to review, all now queued up, thanks!

greg k-h