public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Staging: rtl8712: Removed unused return variable
@ 2015-04-23 15:00 DHANAPAL, GNANACHANDRAN (G.)
  2015-04-23 15:29 ` Larry Finger
  2015-04-24  5:57 ` Sudip Mukherjee
  0 siblings, 2 replies; 4+ messages in thread
From: DHANAPAL, GNANACHANDRAN (G.) @ 2015-04-23 15:00 UTC (permalink / raw)
  To: gregkh@linuxfoundation.org
  Cc: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com,
	thomas@grouk.net, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org, Babu, Viswanathan (V.),
	vthakkar1994@gmail.com

This patch removes unused return variable in this file.

Signed-off-by: Gnanachandran Dhanapal <gdhanapa@visteon.com>
---
 drivers/staging/rtl8712/os_intfs.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c
index 6e776e5..b881368 100644
--- a/drivers/staging/rtl8712/os_intfs.c
+++ b/drivers/staging/rtl8712/os_intfs.c
@@ -128,7 +128,6 @@ static int netdev_close(struct net_device *pnetdev);
 
 static uint loadparam(struct _adapter *padapter, struct  net_device *pnetdev)
 {
-	uint status = _SUCCESS;
 	struct registry_priv  *registry_par = &padapter->registrypriv;
 
 	registry_par->chip_version = (u8)chip_version;
@@ -172,7 +171,7 @@ static uint loadparam(struct _adapter *padapter, struct  net_device *pnetdev)
 	registry_par->low_power = (u8)low_power;
 	registry_par->wifi_test = (u8) wifi_test;
 	r8712_initmac = initmac;
-	return status;
+	return _SUCCESS;
 }
 
 static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p)
@@ -273,7 +272,6 @@ void r8712_stop_drv_timers(struct _adapter *padapter)
 
 static u8 init_default_value(struct _adapter *padapter)
 {
-	u8 ret  = _SUCCESS;
 	struct registry_priv *pregistrypriv = &padapter->registrypriv;
 	struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -306,7 +304,7 @@ static u8 init_default_value(struct _adapter *padapter)
 	r8712_init_registrypriv_dev_network(padapter);
 	r8712_update_registrypriv_dev_network(padapter);
 	/*misc.*/
-	return ret;
+	return _SUCCESS;
 }
 
 u8 r8712_init_drv_sw(struct _adapter *padapter)
-- 
1.7.9.5

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

* Re: [PATCH v2] Staging: rtl8712: Removed unused return variable
  2015-04-23 15:00 [PATCH v2] Staging: rtl8712: Removed unused return variable DHANAPAL, GNANACHANDRAN (G.)
@ 2015-04-23 15:29 ` Larry Finger
  2015-04-23 15:57   ` Dan Carpenter
  2015-04-24  5:57 ` Sudip Mukherjee
  1 sibling, 1 reply; 4+ messages in thread
From: Larry Finger @ 2015-04-23 15:29 UTC (permalink / raw)
  To: DHANAPAL, GNANACHANDRAN (G.), gregkh@linuxfoundation.org
  Cc: florian.c.schilhabel@googlemail.com, thomas@grouk.net,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Babu, Viswanathan (V.), vthakkar1994@gmail.com

On 04/23/2015 10:00 AM, DHANAPAL, GNANACHANDRAN (G.) wrote:
> This patch removes unused return variable in this file.

You should hold off with V2 to give others a chance to comment.

Your commit message does not exactly describe what is happening. The return 
variable is not unused. More accurately, you have rewritten the routine to 
always return a constant.

I have not looked at the generated code, but I suspect that gcc is already doing 
that when it optimizes the code. If you really want to reduce the size of the 
generated code, there is no reason for this function to be of type uint. It 
should be type void and not return anything.

Larry

>
> Signed-off-by: Gnanachandran Dhanapal <gdhanapa@visteon.com>
> ---
>   drivers/staging/rtl8712/os_intfs.c |    6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c
> index 6e776e5..b881368 100644
> --- a/drivers/staging/rtl8712/os_intfs.c
> +++ b/drivers/staging/rtl8712/os_intfs.c
> @@ -128,7 +128,6 @@ static int netdev_close(struct net_device *pnetdev);
>
>   static uint loadparam(struct _adapter *padapter, struct  net_device *pnetdev)
>   {
> -	uint status = _SUCCESS;
>   	struct registry_priv  *registry_par = &padapter->registrypriv;
>
>   	registry_par->chip_version = (u8)chip_version;
> @@ -172,7 +171,7 @@ static uint loadparam(struct _adapter *padapter, struct  net_device *pnetdev)
>   	registry_par->low_power = (u8)low_power;
>   	registry_par->wifi_test = (u8) wifi_test;
>   	r8712_initmac = initmac;
> -	return status;
> +	return _SUCCESS;
>   }
>
>   static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p)
> @@ -273,7 +272,6 @@ void r8712_stop_drv_timers(struct _adapter *padapter)
>
>   static u8 init_default_value(struct _adapter *padapter)
>   {
> -	u8 ret  = _SUCCESS;
>   	struct registry_priv *pregistrypriv = &padapter->registrypriv;
>   	struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
>   	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> @@ -306,7 +304,7 @@ static u8 init_default_value(struct _adapter *padapter)
>   	r8712_init_registrypriv_dev_network(padapter);
>   	r8712_update_registrypriv_dev_network(padapter);
>   	/*misc.*/
> -	return ret;
> +	return _SUCCESS;
>   }
>
>   u8 r8712_init_drv_sw(struct _adapter *padapter)
>


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

* Re: [PATCH v2] Staging: rtl8712: Removed unused return variable
  2015-04-23 15:29 ` Larry Finger
@ 2015-04-23 15:57   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-04-23 15:57 UTC (permalink / raw)
  To: Larry Finger
  Cc: DHANAPAL, GNANACHANDRAN (G.), gregkh@linuxfoundation.org,
	devel@driverdev.osuosl.org, florian.c.schilhabel@googlemail.com,
	thomas@grouk.net, Babu, Viswanathan (V.), vthakkar1994@gmail.com,
	linux-kernel@vger.kernel.org

This patch is a coccinelle thing, the reasoning behind it is that
literals are more clear than variables.

	return status; <-- Ambiguous.  This could be returning anything,
			   you have to look at the context.

	return 0;  <-- Clear.

regards,
dan carpenter


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

* Re: [PATCH v2] Staging: rtl8712: Removed unused return variable
  2015-04-23 15:00 [PATCH v2] Staging: rtl8712: Removed unused return variable DHANAPAL, GNANACHANDRAN (G.)
  2015-04-23 15:29 ` Larry Finger
@ 2015-04-24  5:57 ` Sudip Mukherjee
  1 sibling, 0 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2015-04-24  5:57 UTC (permalink / raw)
  To: DHANAPAL, GNANACHANDRAN (G.)
  Cc: gregkh@linuxfoundation.org, Larry.Finger@lwfinger.net,
	florian.c.schilhabel@googlemail.com, thomas@grouk.net,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Babu, Viswanathan (V.), vthakkar1994@gmail.com

On Thu, Apr 23, 2015 at 03:00:14PM +0000, DHANAPAL, GNANACHANDRAN (G.) wrote:
> This patch removes unused return variable in this file.
> 
> Signed-off-by: Gnanachandran Dhanapal <gdhanapa@visteon.com>
> ---

your From: name and Signed-off-by: name is not matching.

regards
sudip

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

end of thread, other threads:[~2015-04-24  5:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-23 15:00 [PATCH v2] Staging: rtl8712: Removed unused return variable DHANAPAL, GNANACHANDRAN (G.)
2015-04-23 15:29 ` Larry Finger
2015-04-23 15:57   ` Dan Carpenter
2015-04-24  5:57 ` Sudip Mukherjee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox