All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: wilc1000: host_interface.c: Modify return statement.
@ 2019-03-28 17:56 Sanjana Sanikommu
  2019-03-28 18:50 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Sanjana Sanikommu @ 2019-03-28 17:56 UTC (permalink / raw)
  To: gregkh; +Cc: outreachy-kernel

Challenge suggested by coccinelle.
Remove return variable and directly return the value
Issue found using ret.cocci

Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
---
 drivers/staging/wilc1000/host_interface.c | 23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 4dd9a20f6a0b..a10c31bce07f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1358,17 +1358,14 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid)
 {
 	struct wid wid;
-	int result;
 
 	wid.id = WID_PMKID_INFO;
 	wid.type = WID_STR;
 	wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
 	wid.val = (u8 *)pmkid;
 
-	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
 				      wilc_get_vif_idx(vif));
-
-	return result;
 }
 
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
@@ -1403,8 +1400,7 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ies,
 		conn_info->req_ies_len = ies_len;
 		conn_info->req_ies = kmemdup(ies, ies_len, GFP_KERNEL);
 		if (!conn_info->req_ies) {
-			result = -ENOMEM;
-			return result;
+			return -ENOMEM;
 		}
 	}
 
@@ -1570,7 +1566,6 @@ int wilc_hif_set_cfg(struct wilc_vif *vif, struct cfg_param_attr *param)
 {
 	struct wid wid_list[4];
 	int i = 0;
-	int result;
 
 	if (param->flag & WILC_CFG_PARAM_RETRY_SHORT) {
 		wid_list[i].id = WID_SHORT_RETRY_LIMIT;
@@ -1601,10 +1596,8 @@ int wilc_hif_set_cfg(struct wilc_vif *vif, struct cfg_param_attr *param)
 		i++;
 	}
 
-	result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
+	return wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
 				      i, wilc_get_vif_idx(vif));
-
-	return result;
 }
 
 static void get_periodic_rssi(struct timer_list *t)
@@ -2121,7 +2114,6 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, u32 enabled, u32 count,
 
 int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
 {
-	int ret;
 	struct wid wid;
 
 	wid.id = WID_TX_POWER;
@@ -2129,15 +2121,12 @@ int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
 	wid.val = &tx_power;
 	wid.size = sizeof(char);
 
-	ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
 				   wilc_get_vif_idx(vif));
-
-	return ret;
 }
 
 int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
 {
-	int ret;
 	struct wid wid;
 
 	wid.id = WID_TX_POWER;
@@ -2145,8 +2134,6 @@ int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
 	wid.val = tx_power;
 	wid.size = sizeof(char);
 
-	ret = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
+	return wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
 				   wilc_get_vif_idx(vif));
-
-	return ret;
 }
-- 
2.17.1



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

* Re: [Outreachy kernel] [PATCH] staging: wilc1000: host_interface.c: Modify return statement.
  2019-03-28 17:56 [PATCH] staging: wilc1000: host_interface.c: Modify return statement Sanjana Sanikommu
@ 2019-03-28 18:50 ` Julia Lawall
  2019-03-29  1:58   ` Sanjana Sanikommu
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2019-03-28 18:50 UTC (permalink / raw)
  To: Sanjana Sanikommu; +Cc: gregkh, outreachy-kernel



On Thu, 28 Mar 2019, Sanjana Sanikommu wrote:

> Challenge suggested by coccinelle.
> Remove return variable and directly return the value
> Issue found using ret.cocci
>
> Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
> ---
>  drivers/staging/wilc1000/host_interface.c | 23 +++++------------------
>  1 file changed, 5 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
> index 4dd9a20f6a0b..a10c31bce07f 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -1358,17 +1358,14 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
>  int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid)
>  {
>  	struct wid wid;
> -	int result;
>
>  	wid.id = WID_PMKID_INFO;
>  	wid.type = WID_STR;
>  	wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
>  	wid.val = (u8 *)pmkid;
>
> -	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
> +	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
>  				      wilc_get_vif_idx(vif));

The last argument needs to be moved.  Please check the other cases for the
same issue.

julia

> -
> -	return result;
>  }
>
>  int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
> @@ -1403,8 +1400,7 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ies,
>  		conn_info->req_ies_len = ies_len;
>  		conn_info->req_ies = kmemdup(ies, ies_len, GFP_KERNEL);
>  		if (!conn_info->req_ies) {
> -			result = -ENOMEM;
> -			return result;
> +			return -ENOMEM;
>  		}
>  	}
>
> @@ -1570,7 +1566,6 @@ int wilc_hif_set_cfg(struct wilc_vif *vif, struct cfg_param_attr *param)
>  {
>  	struct wid wid_list[4];
>  	int i = 0;
> -	int result;
>
>  	if (param->flag & WILC_CFG_PARAM_RETRY_SHORT) {
>  		wid_list[i].id = WID_SHORT_RETRY_LIMIT;
> @@ -1601,10 +1596,8 @@ int wilc_hif_set_cfg(struct wilc_vif *vif, struct cfg_param_attr *param)
>  		i++;
>  	}
>
> -	result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
> +	return wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
>  				      i, wilc_get_vif_idx(vif));
> -
> -	return result;
>  }
>
>  static void get_periodic_rssi(struct timer_list *t)
> @@ -2121,7 +2114,6 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, u32 enabled, u32 count,
>
>  int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
>  {
> -	int ret;
>  	struct wid wid;
>
>  	wid.id = WID_TX_POWER;
> @@ -2129,15 +2121,12 @@ int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
>  	wid.val = &tx_power;
>  	wid.size = sizeof(char);
>
> -	ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
> +	return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
>  				   wilc_get_vif_idx(vif));
> -
> -	return ret;
>  }
>
>  int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
>  {
> -	int ret;
>  	struct wid wid;
>
>  	wid.id = WID_TX_POWER;
> @@ -2145,8 +2134,6 @@ int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
>  	wid.val = tx_power;
>  	wid.size = sizeof(char);
>
> -	ret = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
> +	return wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
>  				   wilc_get_vif_idx(vif));
> -
> -	return ret;
>  }
> --
> 2.17.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/20190328175622.27971-1-sanjana99reddy99%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] staging: wilc1000: host_interface.c: Modify return statement.
  2019-03-28 18:50 ` [Outreachy kernel] " Julia Lawall
@ 2019-03-29  1:58   ` Sanjana Sanikommu
  0 siblings, 0 replies; 3+ messages in thread
From: Sanjana Sanikommu @ 2019-03-29  1:58 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Greg KH, outreachy-kernel

[-- Attachment #1: Type: text/plain, Size: 5058 bytes --]

On Fri, 29 Mar 2019, 00:20 Julia Lawall, <julia.lawall@lip6.fr> wrote:

>
>
> On Thu, 28 Mar 2019, Sanjana Sanikommu wrote:
>
> > Challenge suggested by coccinelle.
> > Remove return variable and directly return the value
> > Issue found using ret.cocci
> >
> > Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
> > ---
> >  drivers/staging/wilc1000/host_interface.c | 23 +++++------------------
> >  1 file changed, 5 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/staging/wilc1000/host_interface.c
> b/drivers/staging/wilc1000/host_interface.c
> > index 4dd9a20f6a0b..a10c31bce07f 100644
> > --- a/drivers/staging/wilc1000/host_interface.c
> > +++ b/drivers/staging/wilc1000/host_interface.c
> > @@ -1358,17 +1358,14 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const
> u8 *rx_gtk, u8 gtk_key_len,
> >  int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr
> *pmkid)
> >  {
> >       struct wid wid;
> > -     int result;
> >
> >       wid.id = WID_PMKID_INFO;
> >       wid.type = WID_STR;
> >       wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
> >       wid.val = (u8 *)pmkid;
> >
> > -     result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
> > +     return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
> >                                     wilc_get_vif_idx(vif));
>
> The last argument needs to be moved.  Please check the other cases for the
> same issue.
>

   I will adjust the spaces.

   Sanjana

>
> julia
>
> > -
> > -     return result;
> >  }
> >
> >  int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
> > @@ -1403,8 +1400,7 @@ int wilc_set_join_req(struct wilc_vif *vif, u8
> *bssid, const u8 *ies,
> >               conn_info->req_ies_len = ies_len;
> >               conn_info->req_ies = kmemdup(ies, ies_len, GFP_KERNEL);
> >               if (!conn_info->req_ies) {
> > -                     result = -ENOMEM;
> > -                     return result;
> > +                     return -ENOMEM;
> >               }
> >       }
> >
> > @@ -1570,7 +1566,6 @@ int wilc_hif_set_cfg(struct wilc_vif *vif, struct
> cfg_param_attr *param)
> >  {
> >       struct wid wid_list[4];
> >       int i = 0;
> > -     int result;
> >
> >       if (param->flag & WILC_CFG_PARAM_RETRY_SHORT) {
> >               wid_list[i].id = WID_SHORT_RETRY_LIMIT;
> > @@ -1601,10 +1596,8 @@ int wilc_hif_set_cfg(struct wilc_vif *vif, struct
> cfg_param_attr *param)
> >               i++;
> >       }
> >
> > -     result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
> > +     return wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
> >                                     i, wilc_get_vif_idx(vif));
> > -
> > -     return result;
> >  }
> >
> >  static void get_periodic_rssi(struct timer_list *t)
> > @@ -2121,7 +2114,6 @@ int wilc_setup_multicast_filter(struct wilc_vif
> *vif, u32 enabled, u32 count,
> >
> >  int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
> >  {
> > -     int ret;
> >       struct wid wid;
> >
> >       wid.id = WID_TX_POWER;
> > @@ -2129,15 +2121,12 @@ int wilc_set_tx_power(struct wilc_vif *vif, u8
> tx_power)
> >       wid.val = &tx_power;
> >       wid.size = sizeof(char);
> >
> > -     ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
> > +     return wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
> >                                  wilc_get_vif_idx(vif));
> > -
> > -     return ret;
> >  }
> >
> >  int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
> >  {
> > -     int ret;
> >       struct wid wid;
> >
> >       wid.id = WID_TX_POWER;
> > @@ -2145,8 +2134,6 @@ int wilc_get_tx_power(struct wilc_vif *vif, u8
> *tx_power)
> >       wid.val = tx_power;
> >       wid.size = sizeof(char);
> >
> > -     ret = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
> > +     return wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
> >                                  wilc_get_vif_idx(vif));
> > -
> > -     return ret;
> >  }
> > --
> > 2.17.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/20190328175622.27971-1-sanjana99reddy99%40gmail.com
> .
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> 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/alpine.DEB.2.21.1903281949430.2760%40hadrien
> .
> For more options, visit https://groups.google.com/d/optout.
>

[-- Attachment #2: Type: text/html, Size: 7802 bytes --]

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

end of thread, other threads:[~2019-03-29  1:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-28 17:56 [PATCH] staging: wilc1000: host_interface.c: Modify return statement Sanjana Sanikommu
2019-03-28 18:50 ` [Outreachy kernel] " Julia Lawall
2019-03-29  1:58   ` Sanjana Sanikommu

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.