* [PATCH v2] Staging: drivers: Remove unecessary return value
@ 2015-03-16 20:50 Cristina Opriceana
2015-03-16 21:02 ` [Outreachy kernel] " Julia Lawall
2015-03-17 9:45 ` Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: Cristina Opriceana @ 2015-03-16 20:50 UTC (permalink / raw)
To: outreachy-kernel; +Cc: outreachy-kernel
Change _SUCCESS return value for function loadparam to void as it never
changes and it's also never used when calling the function.
Done with coccinelle:
@rule@
typedef uint;
@@
(
-uint
|
-int
)
+void
loadparam(...)
{
...
-return _SUCCESS;
}
Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
Changes in v2:
- use coccinelle script to apply the changes easier
- reaply patch on the refreshed tree
drivers/staging/rtl8188eu/os_dep/os_intfs.c | 3 +--
drivers/staging/rtl8723au/os_dep/os_intfs.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index 750c87b..218c69a 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -510,7 +510,7 @@ void rtw_proc_remove_one(struct net_device *dev)
}
#endif
-static uint loadparam(struct adapter *padapter, struct net_device *pnetdev)
+static void loadparam(struct adapter *padapter, struct net_device *pnetdev)
{
struct registry_priv *registry_par = &padapter->registrypriv;
@@ -581,7 +581,6 @@ static uint loadparam(struct adapter *padapter, struct net_device *pnetdev)
snprintf(registry_par->ifname, 16, "%s", ifname);
snprintf(registry_par->if2name, 16, "%s", if2name);
registry_par->notch_filter = (u8)rtw_notch_filter;
- return _SUCCESS;
}
static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p)
diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c
index db6a1597..0f1ae47 100644
--- a/drivers/staging/rtl8723au/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c
@@ -172,7 +172,7 @@ MODULE_PARM_DESC(debug, "Set debug level (1-9) (default 1)");
static int netdev_close(struct net_device *pnetdev);
-static int loadparam(struct rtw_adapter *padapter, struct net_device *pnetdev)
+static void loadparam(struct rtw_adapter *padapter, struct net_device *pnetdev)
{
struct registry_priv *registry_par = &padapter->registrypriv;
@@ -233,7 +233,6 @@ static int loadparam(struct rtw_adapter *padapter, struct net_device *pnetdev)
snprintf(registry_par->if2name, 16, "%s", if2name);
registry_par->notch_filter = (u8)rtw_notch_filter;
registry_par->regulatory_tid = (u8)rtw_regulatory_id;
- return _SUCCESS;
}
static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p)
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH v2] Staging: drivers: Remove unecessary return value
2015-03-16 20:50 [PATCH v2] Staging: drivers: Remove unecessary return value Cristina Opriceana
@ 2015-03-16 21:02 ` Julia Lawall
2015-03-17 9:45 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2015-03-16 21:02 UTC (permalink / raw)
To: Cristina Opriceana; +Cc: outreachy-kernel
On Mon, 16 Mar 2015, Cristina Opriceana wrote:
> Change _SUCCESS return value for function loadparam to void as it never
> changes and it's also never used when calling the function.
>
> Done with coccinelle:
> @rule@
> typedef uint;
> @@
>
> (
> -uint
> |
> -int
> )
> +void
> loadparam(...)
> {
> ...
> -return _SUCCESS;
> }
... does check that all of the posible execution paths have the property,
but it is willing to overlook failure paths, ie paths under
if (...) {
...
return ...;
}
The idea is that such paths may cut short the expected execution. Here,
however, you want to be sure that you end up with _SUCCESS on all paths,
whether representing success or failure. In that case, you can pu when
strict after the ..., to be sure that really every path is taken into
account.
For the return type, you could just put a metavariable T. You don't
really care how it it written. It will be some description of _SUCCESS.
With those changes, you could try replacing load param by an identifier
metavariable. Maybe there are some other functions that have the same
pattern.
julia
>
> Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
> ---
> Changes in v2:
> - use coccinelle script to apply the changes easier
> - reaply patch on the refreshed tree
>
> drivers/staging/rtl8188eu/os_dep/os_intfs.c | 3 +--
> drivers/staging/rtl8723au/os_dep/os_intfs.c | 3 +--
> 2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
> index 750c87b..218c69a 100644
> --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
> +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
> @@ -510,7 +510,7 @@ void rtw_proc_remove_one(struct net_device *dev)
> }
> #endif
>
> -static uint loadparam(struct adapter *padapter, struct net_device *pnetdev)
> +static void loadparam(struct adapter *padapter, struct net_device *pnetdev)
> {
> struct registry_priv *registry_par = &padapter->registrypriv;
>
> @@ -581,7 +581,6 @@ static uint loadparam(struct adapter *padapter, struct net_device *pnetdev)
> snprintf(registry_par->ifname, 16, "%s", ifname);
> snprintf(registry_par->if2name, 16, "%s", if2name);
> registry_par->notch_filter = (u8)rtw_notch_filter;
> - return _SUCCESS;
> }
>
> static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p)
> diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c
> index db6a1597..0f1ae47 100644
> --- a/drivers/staging/rtl8723au/os_dep/os_intfs.c
> +++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c
> @@ -172,7 +172,7 @@ MODULE_PARM_DESC(debug, "Set debug level (1-9) (default 1)");
>
> static int netdev_close(struct net_device *pnetdev);
>
> -static int loadparam(struct rtw_adapter *padapter, struct net_device *pnetdev)
> +static void loadparam(struct rtw_adapter *padapter, struct net_device *pnetdev)
> {
> struct registry_priv *registry_par = &padapter->registrypriv;
>
> @@ -233,7 +233,6 @@ static int loadparam(struct rtw_adapter *padapter, struct net_device *pnetdev)
> snprintf(registry_par->if2name, 16, "%s", if2name);
> registry_par->notch_filter = (u8)rtw_notch_filter;
> registry_par->regulatory_tid = (u8)rtw_regulatory_id;
> - return _SUCCESS;
> }
>
> static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p)
> --
> 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/f972425373892a028f783e456e9990fa1ffba62a.1426538724.git.cristina.opriceana%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH v2] Staging: drivers: Remove unecessary return value
2015-03-16 20:50 [PATCH v2] Staging: drivers: Remove unecessary return value Cristina Opriceana
2015-03-16 21:02 ` [Outreachy kernel] " Julia Lawall
@ 2015-03-17 9:45 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2015-03-17 9:45 UTC (permalink / raw)
To: Cristina Opriceana; +Cc: outreachy-kernel
On Mon, Mar 16, 2015 at 10:50:22PM +0200, Cristina Opriceana wrote:
> Change _SUCCESS return value for function loadparam to void as it never
> changes and it's also never used when calling the function.
When you do this, please break it up into one-patch-per driver, to make
it easier to review and merge.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-17 9:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-16 20:50 [PATCH v2] Staging: drivers: Remove unecessary return value Cristina Opriceana
2015-03-16 21:02 ` [Outreachy kernel] " Julia Lawall
2015-03-17 9:45 ` 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.