Skip to contentSkip to conversation

staging: rtl8723bs: Remove unused variable ret

PATCH In review Harsha Sharma 3 participants 4 messages Sep 14, 2017 – Sep 18, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: Remove unused variable ret

Remove unused variable ret as it is not used anywhere. Remove multiple blank lines.
Done using following coccinelle semantic patch

@@
type T;
identifier i;
constant C;
@@

(
extern T i;
|
- T i;
<+... when != i
- i = C;
...+>
)

---
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +0 -6
index ffbb35a..7935dc5 100644
@@ -2337,10 +2337,6 @@ static int rtw_wx_read32(struct net_device *dev,
 	u32 data32;
 	u32 bytes;
 	u8 *ptmp;
-	int ret;
-
-
-	ret = 0;
 	padapter = (struct adapter *)rtw_netdev_priv(dev);
 	p = &wrqu->data;
 	len = p->length;
@@ -2352,7 +2348,6 @@ static int rtw_wx_read32(struct net_device *dev,
 		return -ENOMEM;
 
 	if (copy_from_user(ptmp, p->pointer, len)) {
-		ret = -EFAULT;
 		goto exit;
 	}
 
@@ -2375,7 +2370,6 @@ static int rtw_wx_read32(struct net_device *dev,
 			break;
 		default:
 			DBG_871X(KERN_INFO "%s: usage> read [bytes],[address(hex)]\n", __func__);
-			ret = -EINVAL;
 			goto exit;
 	}
 	DBG_871X(KERN_INFO "%s: addr = 0x%08X data =%s\n", __func__, addr, extra);
Signature · 1 line
1.9.1
#1 lore raw
Quoted 48 lines · Harsha Sharma

Remove unused variable ret as it is not used anywhere. Remove multiple blank lines.
Done using following coccinelle semantic patch

@@
type T;
identifier i;
constant C;
@@

(
extern T i;
|
- T i;
<+... when != i
- i = C;
...+>
)

---
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +0 -5
index ffbb35a..7935dc5 100644
@@ -2337,10 +2337,6 @@ static int rtw_wx_read32(struct net_device *dev,
 	u32 data32;
 	u32 bytes;
 	u8 *ptmp;
-	int ret;
-
-
-	ret = 0;
 	padapter = (struct adapter *)rtw_netdev_priv(dev);
 	p = &wrqu->data;
 	len = p->length;
@@ -2352,7 +2348,6 @@ static int rtw_wx_read32(struct net_device *dev,
 		return -ENOMEM;
 
 	if (copy_from_user(ptmp, p->pointer, len)) {
-		ret = -EFAULT;
 		goto exit;
 	}
 

drivers/staging/rtl8723bs/os_dep/ioctl_linux.c static int rtw_wx_read32(struct net_device *dev, · line 2373

Quoted 5 lines
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +0 -1
@@ -2375,7 +2370,6 @@ static int rtw_wx_read32(struct net_device *dev,
 			break;
 		default:
 			DBG_871X(KERN_INFO "%s: usage> read [bytes],[address(hex)]\n", __func__);
-			ret = -EINVAL;
 			goto exit;

One could have the impression that the function should instead return ret. One would have to figure out where the function is called from and what happens there to the return value.

julia

Quoted 12 lines
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +0 -1
 	}
 	DBG_871X(KERN_INFO "%s: addr = 0x%08X data =%s\n", __func__, addr, extra);
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1505404910-11548-1-git-send-email-harshasharmaiitr%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw

Hi,
Yes, you are right but the function returns 0 in the end and the changes compiles well .
Thanks a lot for your feedback.

Regards,
Harsha Sharma

Quoted 84 lines · Julia Lawall
Quoted 19 lines · Harsha Sharma

Remove unused variable ret as it is not used anywhere. Remove multiple blank lines.
Done using following coccinelle semantic patch

@@
type T;
identifier i;
constant C;
@@

(
extern T i;
|
- T i;
<+... when != i
- i = C;
...+>
)

Review

Quoted 6 lines
---
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 ------
 1 file changed, 6 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c

Quoted 23 lines

index ffbb35a..7935dc5 100644

drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +0 -5
@@ -2337,10 +2337,6 @@ static int rtw_wx_read32(struct net_device *dev,
      u32 data32;
      u32 bytes;
      u8 *ptmp;
-     int ret;
-
-
-     ret = 0;
      padapter = (struct adapter *)rtw_netdev_priv(dev);
      p = &wrqu->data;
      len = p->length;
@@ -2352,7 +2348,6 @@ static int rtw_wx_read32(struct net_device *dev,
              return -ENOMEM;
 
      if (copy_from_user(ptmp, p->pointer, len)) {
-             ret = -EFAULT;
              goto exit;
      }
 

drivers/staging/rtl8723bs/os_dep/ioctl_linux.c static int rtw_wx_read32(struct net_device *dev, · line 2372

Quoted 3 lines
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +0 -0
@@ -2375,7 +2370,6 @@ static int rtw_wx_read32(struct net_device *dev,
                      break;
              default:
                      DBG_871X(KERN_INFO "%s: usage> read

[bytes],[address(hex)]\n", __func__);

drivers/staging/rtl8723bs/os_dep/ioctl_linux.c static int rtw_wx_read32(struct net_device *dev, · line 2373

Quoted 2 lines
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +0 -1
-                     ret = -EINVAL;
                      goto exit;

One could have the impression that the function should instead return ret. One would have to figure out where the function is called from and what happens there to the return value.

julia

drivers/staging/rtl8723bs/os_dep/ioctl_linux.c static int rtw_wx_read32(struct net_device *dev, · line 2375

Quoted 2 lines
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +0 -0
      }
      DBG_871X(KERN_INFO "%s: addr = 0x%08X data =%s\n", __func__, addr,

extra);

Quoted 5 lines

--
1.9.1

--
You received this message because you are subscribed to the Google

Groups "outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an email to [email protected].

Quoted 2 lines

To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/

msgid/outreachy-kernel/1505404910-11548-1-git-send-email-harshasharmaiitr% 40gmail.com.

Quoted 2 lines

For more options, visit https://groups.google.com/d/optout.

maintainer
#3 lore raw
Quoted 3 lines · Harsha Sharma

Hi,
Yes, you are right but the function returns 0 in the end and the changes compiles well .

Then the function is incorrect, it should be reporting back that error.

thanks,

greg k-h