* [PATCH] staging: rtl8723bs: Remove unused variable ret
@ 2017-09-14 16:01 Harsha Sharma
2017-09-14 16:09 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 4+ messages in thread
From: Harsha Sharma @ 2017-09-14 16:01 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, outreachy-kernel, 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;
...+>
)
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
---
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index ffbb35a..7935dc5 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -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);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Remove unused variable ret
2017-09-14 16:01 [PATCH] staging: rtl8723bs: Remove unused variable ret Harsha Sharma
@ 2017-09-14 16:09 ` Julia Lawall
2017-09-14 16:51 ` Harsha Sharma
0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2017-09-14 16:09 UTC (permalink / raw)
To: Harsha Sharma; +Cc: gregkh, devel, linux-kernel, outreachy-kernel
On Thu, 14 Sep 2017, Harsha Sharma wrote:
> 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;
> ...+>
> )
>
> Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
> ---
> drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> index ffbb35a..7935dc5 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> @@ -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;
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
> }
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Remove unused variable ret
2017-09-14 16:09 ` [Outreachy kernel] " Julia Lawall
@ 2017-09-14 16:51 ` Harsha Sharma
2017-09-18 9:55 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Harsha Sharma @ 2017-09-14 16:51 UTC (permalink / raw)
To: Julia Lawall; +Cc: Greg KH, devel, linux-kernel, outreachy-kernel
[-- Attachment #1: Type: text/plain, Size: 2768 bytes --]
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
On Thu, Sep 14, 2017 at 9:39 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Thu, 14 Sep 2017, Harsha Sharma wrote:
>
> > 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;
> > ...+>
> > )
> >
> > Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
> > ---
> > drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 ------
> > 1 file changed, 6 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > index ffbb35a..7935dc5 100644
> > --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > @@ -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;
>
> 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
>
> > }
> > 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 outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > 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.
> >
>
[-- Attachment #2: Type: text/html, Size: 4344 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Remove unused variable ret
2017-09-14 16:51 ` Harsha Sharma
@ 2017-09-18 9:55 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2017-09-18 9:55 UTC (permalink / raw)
To: Harsha Sharma; +Cc: Julia Lawall, devel, linux-kernel, outreachy-kernel
On Thu, Sep 14, 2017 at 10:21:29PM +0530, Harsha Sharma wrote:
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-18 9:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-14 16:01 [PATCH] staging: rtl8723bs: Remove unused variable ret Harsha Sharma
2017-09-14 16:09 ` [Outreachy kernel] " Julia Lawall
2017-09-14 16:51 ` Harsha Sharma
2017-09-18 9:55 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.