linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: r8188eu: core: remove goto statement
@ 2021-10-25 12:15 Saurav Girepunje
  2021-10-25 15:15 ` Larry Finger
  0 siblings, 1 reply; 8+ messages in thread
From: Saurav Girepunje @ 2021-10-25 12:15 UTC (permalink / raw)
  To: Larry.Finger, phil, gregkh, straube.linux, saurav.girepunje,
	fmdefrancesco, linux-staging, linux-kernel
  Cc: saurav.girepunje

Remove the goto statement from rtw_do_join(). In this function goto
can be replace by return statement. As on goto label exit, function only
return it is not performing any cleanup. Avoiding goto will improve
the function readability.

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_ioctl_set.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_ioctl_set.c b/drivers/staging/r8188eu/core/rtw_ioctl_set.c
index 2b54cdfa9d6e..411b06e135be 100644
--- a/drivers/staging/r8188eu/core/rtw_ioctl_set.c
+++ b/drivers/staging/r8188eu/core/rtw_ioctl_set.c
@@ -51,7 +51,7 @@ u8 rtw_do_join(struct adapter *padapter)
 			ret = _FAIL;
 		}

-		goto exit;
+		return ret;
 	} else {
 		int select_ret;

@@ -78,10 +78,9 @@ u8 rtw_do_join(struct adapter *padapter)

 				rtw_generate_random_ibss(pibss);

-				if (rtw_createbss_cmd(padapter) != _SUCCESS) {
-					ret =  false;
-					goto exit;
-				}
+				if (rtw_createbss_cmd(padapter) != _SUCCESS)
+					return false;
+
 				pmlmepriv->to_join = false;
 			} else {
 				/*  can't associate ; reset under-linking */
@@ -102,8 +101,6 @@ u8 rtw_do_join(struct adapter *padapter)
 		}
 	}

-exit:
-
 	return ret;
 }

--
2.33.0


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

* Re: [PATCH] staging: r8188eu: core: remove goto statement
  2021-10-25 12:15 [PATCH] staging: r8188eu: core: remove goto statement Saurav Girepunje
@ 2021-10-25 15:15 ` Larry Finger
  2021-10-25 17:00   ` Saurav Girepunje
  0 siblings, 1 reply; 8+ messages in thread
From: Larry Finger @ 2021-10-25 15:15 UTC (permalink / raw)
  To: Saurav Girepunje, phil, gregkh, straube.linux, fmdefrancesco,
	linux-staging, linux-kernel
  Cc: saurav.girepunje

On 10/25/21 07:15, Saurav Girepunje wrote:
> Remove the goto statement from rtw_do_join(). In this function goto
> can be replace by return statement. As on goto label exit, function only
> return it is not performing any cleanup. Avoiding goto will improve
> the function readability.
> 
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---

You need to read section 14 of Documentation/process/submitting-patches.rst to 
learn how to submit a revised patch. Resubmitting such a revision using the same 
subject line is likely to confuse reviewers and maintainers alike, if not 
patchworks.

Larry

>   drivers/staging/r8188eu/core/rtw_ioctl_set.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_ioctl_set.c b/drivers/staging/r8188eu/core/rtw_ioctl_set.c
> index 2b54cdfa9d6e..411b06e135be 100644
> --- a/drivers/staging/r8188eu/core/rtw_ioctl_set.c
> +++ b/drivers/staging/r8188eu/core/rtw_ioctl_set.c
> @@ -51,7 +51,7 @@ u8 rtw_do_join(struct adapter *padapter)
>   			ret = _FAIL;
>   		}
> 
> -		goto exit;
> +		return ret;
>   	} else {
>   		int select_ret;
> 
> @@ -78,10 +78,9 @@ u8 rtw_do_join(struct adapter *padapter)
> 
>   				rtw_generate_random_ibss(pibss);
> 
> -				if (rtw_createbss_cmd(padapter) != _SUCCESS) {
> -					ret =  false;
> -					goto exit;
> -				}
> +				if (rtw_createbss_cmd(padapter) != _SUCCESS)
> +					return false;
> +
>   				pmlmepriv->to_join = false;
>   			} else {
>   				/*  can't associate ; reset under-linking */
> @@ -102,8 +101,6 @@ u8 rtw_do_join(struct adapter *padapter)
>   		}
>   	}
> 
> -exit:
> -
>   	return ret;
>   }
> 
> --
> 2.33.0
> 


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

* Re: [PATCH] staging: r8188eu: core: remove goto statement
  2021-10-25 15:15 ` Larry Finger
@ 2021-10-25 17:00   ` Saurav Girepunje
  2021-10-25 17:26     ` Larry Finger
  0 siblings, 1 reply; 8+ messages in thread
From: Saurav Girepunje @ 2021-10-25 17:00 UTC (permalink / raw)
  To: Larry Finger, phil, gregkh, straube.linux, fmdefrancesco,
	linux-staging, linux-kernel
  Cc: saurav.girepunje



On 25/10/21 8:45 pm, Larry Finger wrote:
> On 10/25/21 07:15, Saurav Girepunje wrote:
>> Remove the goto statement from rtw_do_join(). In this function goto
>> can be replace by return statement. As on goto label exit, function only
>> return it is not performing any cleanup. Avoiding goto will improve
>> the function readability.
>>
>> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
>> ---
>
Hi Larry,
 
> You need to read section 14 of Documentation/process/submitting-patches.rst to learn how to submit a revised patch. 
Resubmitting such a revision using the same subject line is likely to confuse reviewers and maintainers alike, if not patchworks.
>
This is original patch (v1). I haven't get any review comment for this patch.
 
> Larry

Regards,
Saurav 
> 
>>   drivers/staging/r8188eu/core/rtw_ioctl_set.c | 11 ++++-------
>>   1 file changed, 4 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/staging/r8188eu/core/rtw_ioctl_set.c b/drivers/staging/r8188eu/core/rtw_ioctl_set.c
>> index 2b54cdfa9d6e..411b06e135be 100644
>> --- a/drivers/staging/r8188eu/core/rtw_ioctl_set.c
>> +++ b/drivers/staging/r8188eu/core/rtw_ioctl_set.c
>> @@ -51,7 +51,7 @@ u8 rtw_do_join(struct adapter *padapter)
>>               ret = _FAIL;
>>           }
>>
>> -        goto exit;
>> +        return ret;
>>       } else {
>>           int select_ret;
>>
>> @@ -78,10 +78,9 @@ u8 rtw_do_join(struct adapter *padapter)
>>
>>                   rtw_generate_random_ibss(pibss);
>>
>> -                if (rtw_createbss_cmd(padapter) != _SUCCESS) {
>> -                    ret =  false;
>> -                    goto exit;
>> -                }
>> +                if (rtw_createbss_cmd(padapter) != _SUCCESS)
>> +                    return false;
>> +
>>                   pmlmepriv->to_join = false;
>>               } else {
>>                   /*  can't associate ; reset under-linking */
>> @@ -102,8 +101,6 @@ u8 rtw_do_join(struct adapter *padapter)
>>           }
>>       }
>>
>> -exit:
>> -
>>       return ret;
>>   }
>>
>> -- 
>> 2.33.0
>>
> 

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

* Re: [PATCH] staging: r8188eu: core: remove goto statement
  2021-10-25 17:00   ` Saurav Girepunje
@ 2021-10-25 17:26     ` Larry Finger
  2021-10-25 17:46       ` Saurav Girepunje
  0 siblings, 1 reply; 8+ messages in thread
From: Larry Finger @ 2021-10-25 17:26 UTC (permalink / raw)
  To: Saurav Girepunje, phil, gregkh, straube.linux, fmdefrancesco,
	linux-staging, linux-kernel
  Cc: saurav.girepunje

On 10/25/21 12:00, Saurav Girepunje wrote:
> 
> 
> On 25/10/21 8:45 pm, Larry Finger wrote:
>> On 10/25/21 07:15, Saurav Girepunje wrote:
>>> Remove the goto statement from rtw_do_join(). In this function goto
>>> can be replace by return statement. As on goto label exit, function only
>>> return it is not performing any cleanup. Avoiding goto will improve
>>> the function readability.
>>>
>>> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
>>> ---
>>
> Hi Larry,
>   
>> You need to read section 14 of Documentation/process/submitting-patches.rst to learn how to submit a revised patch.
> Resubmitting such a revision using the same subject line is likely to confuse reviewers and maintainers alike, if not patchworks.
>>
> This is original patch (v1). I haven't get any review comment for this patch.

Why did I get it twice? At least I got two messages with that subject line.

Larry

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

* Re: [PATCH] staging: r8188eu: core: remove goto statement
  2021-10-25 17:26     ` Larry Finger
@ 2021-10-25 17:46       ` Saurav Girepunje
  0 siblings, 0 replies; 8+ messages in thread
From: Saurav Girepunje @ 2021-10-25 17:46 UTC (permalink / raw)
  To: Larry Finger, phil, gregkh, straube.linux, fmdefrancesco,
	linux-staging, linux-kernel
  Cc: saurav.girepunje



On 25/10/21 10:56 pm, Larry Finger wrote:
> On 10/25/21 12:00, Saurav Girepunje wrote:
>>
>>
>> On 25/10/21 8:45 pm, Larry Finger wrote:
>>> On 10/25/21 07:15, Saurav Girepunje wrote:
>>>> Remove the goto statement from rtw_do_join(). In this function goto
>>>> can be replace by return statement. As on goto label exit, function only
>>>> return it is not performing any cleanup. Avoiding goto will improve
>>>> the function readability.
>>>>
>>>> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
>>>> ---
>>>
>> Hi Larry,
>>  
>>> You need to read section 14 of Documentation/process/submitting-patches.rst to learn how to submit a revised patch.
>> Resubmitting such a revision using the same subject line is likely to confuse reviewers and maintainers alike, if not patchworks.
>>>
>> This is original patch (v1). I haven't get any review comment for this patch.
> 
> Why did I get it twice? At least I got two messages with that subject line.
> 
> Larry

I checked on lore.kernel.org . It is one patch with subject "[PATCH] staging: r8188eu: core: remove goto statement"

https://lore.kernel.org/all/?q=Saurav+Girepunje

Regards,
Saurav


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

* Re: [PATCH] staging: r8188eu: core: remove goto statement
  2021-11-10 18:45 ` Dan Carpenter
@ 2021-11-13  5:15   ` Saurav Girepunje
  0 siblings, 0 replies; 8+ messages in thread
From: Saurav Girepunje @ 2021-11-13  5:15 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Larry.Finger, phil, gregkh, straube.linux, martin, linux-staging,
	linux-kernel, saurav.girepunje



On 11/11/21 12:15 am, Dan Carpenter wrote:
> On Wed, Nov 10, 2021 at 11:47:15PM +0530, Saurav Girepunje wrote:
>> Remove the goto statement from _rtw_init_recv_priv(). In this function goto
>> can be replace by return statement. As on goto label exit, function
>> only return it is not performing any cleanup. Avoiding goto will
>> improve the function readability.
>>
>> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
>> ---
>>  drivers/staging/r8188eu/core/rtw_recv.c | 7 ++-----
>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
>> index 51a13262a226..b38af76f3a67 100644
>> --- a/drivers/staging/r8188eu/core/rtw_recv.c
>> +++ b/drivers/staging/r8188eu/core/rtw_recv.c
>> @@ -58,10 +58,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
>>
>>  	precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(struct recv_frame) + RXFRAME_ALIGN_SZ);
>>
>> -	if (!precvpriv->pallocated_frame_buf) {
>> -		res = _FAIL;
>> -		goto exit;
>> -	}
>> +	if (!precvpriv->pallocated_frame_buf)
>> +		return _FAIL;
> 
> 
> I hate pointless "goto exit;" labels, but there isn't a rule against
> them and I feel like this is not a good enough patch on its own.  There
> is so much other stuff wrong with this function.  It probably *should*
> have some error handling for example.
> 
> I don't think this patch really adds enough value.  Take a look at the
> function and almost every line can be improved...
> 
> regards,
> dan carpenter
> 

OK, I will send the other patch to improve this function,
Thanks Dan for review.


Regards,
Saurav 

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

* Re: [PATCH] staging: r8188eu: core: remove goto statement
  2021-11-10 18:17 Saurav Girepunje
@ 2021-11-10 18:45 ` Dan Carpenter
  2021-11-13  5:15   ` Saurav Girepunje
  0 siblings, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2021-11-10 18:45 UTC (permalink / raw)
  To: Saurav Girepunje
  Cc: Larry.Finger, phil, gregkh, straube.linux, martin, linux-staging,
	linux-kernel, saurav.girepunje

On Wed, Nov 10, 2021 at 11:47:15PM +0530, Saurav Girepunje wrote:
> Remove the goto statement from _rtw_init_recv_priv(). In this function goto
> can be replace by return statement. As on goto label exit, function
> only return it is not performing any cleanup. Avoiding goto will
> improve the function readability.
> 
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---
>  drivers/staging/r8188eu/core/rtw_recv.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
> index 51a13262a226..b38af76f3a67 100644
> --- a/drivers/staging/r8188eu/core/rtw_recv.c
> +++ b/drivers/staging/r8188eu/core/rtw_recv.c
> @@ -58,10 +58,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
> 
>  	precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(struct recv_frame) + RXFRAME_ALIGN_SZ);
> 
> -	if (!precvpriv->pallocated_frame_buf) {
> -		res = _FAIL;
> -		goto exit;
> -	}
> +	if (!precvpriv->pallocated_frame_buf)
> +		return _FAIL;


I hate pointless "goto exit;" labels, but there isn't a rule against
them and I feel like this is not a good enough patch on its own.  There
is so much other stuff wrong with this function.  It probably *should*
have some error handling for example.

I don't think this patch really adds enough value.  Take a look at the
function and almost every line can be improved...

regards,
dan carpenter

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

* [PATCH] staging: r8188eu: core: remove goto statement
@ 2021-11-10 18:17 Saurav Girepunje
  2021-11-10 18:45 ` Dan Carpenter
  0 siblings, 1 reply; 8+ messages in thread
From: Saurav Girepunje @ 2021-11-10 18:17 UTC (permalink / raw)
  To: Larry.Finger, phil, gregkh, straube.linux, martin, linux-staging,
	linux-kernel
  Cc: saurav.girepunje

Remove the goto statement from _rtw_init_recv_priv(). In this function goto
can be replace by return statement. As on goto label exit, function
only return it is not performing any cleanup. Avoiding goto will
improve the function readability.

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_recv.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
index 51a13262a226..b38af76f3a67 100644
--- a/drivers/staging/r8188eu/core/rtw_recv.c
+++ b/drivers/staging/r8188eu/core/rtw_recv.c
@@ -58,10 +58,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)

 	precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(struct recv_frame) + RXFRAME_ALIGN_SZ);

-	if (!precvpriv->pallocated_frame_buf) {
-		res = _FAIL;
-		goto exit;
-	}
+	if (!precvpriv->pallocated_frame_buf)
+		return _FAIL;

 	precvpriv->precv_frame_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(precvpriv->pallocated_frame_buf), RXFRAME_ALIGN_SZ);

@@ -89,7 +87,6 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
 	precvpriv->signal_stat_sampling_interval = 1000; /* ms */

 	rtw_set_signal_stat_timer(precvpriv);
-exit:

 	return res;
 }
--
2.33.0


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

end of thread, other threads:[~2021-11-13  5:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25 12:15 [PATCH] staging: r8188eu: core: remove goto statement Saurav Girepunje
2021-10-25 15:15 ` Larry Finger
2021-10-25 17:00   ` Saurav Girepunje
2021-10-25 17:26     ` Larry Finger
2021-10-25 17:46       ` Saurav Girepunje
2021-11-10 18:17 Saurav Girepunje
2021-11-10 18:45 ` Dan Carpenter
2021-11-13  5:15   ` Saurav Girepunje

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).