public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] soc/fsl/qe: Slighly simplify code
@ 2017-08-20 15:53 Christophe JAILLET
  2017-08-20 19:11 ` walter harms
  2017-08-20 21:23 ` Marion & Christophe JAILLET
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2017-08-20 15:53 UTC (permalink / raw)
  To: linux-arm-kernel

Return 0 instead of 'ret' (which is 0 at this point) to make the code more
explicit.
Also avoid a useless initialization of 'ret'.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/soc/fsl/qe/qe_tdm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/fsl/qe/qe_tdm.c b/drivers/soc/fsl/qe/qe_tdm.c
index 6b9647fee512..c90c72ca9e3e 100644
--- a/drivers/soc/fsl/qe/qe_tdm.c
+++ b/drivers/soc/fsl/qe/qe_tdm.c
@@ -42,7 +42,7 @@ int ucc_of_parse_tdm(struct device_node *np, struct ucc_tdm *utdm,
 		     struct ucc_tdm_info *ut_info)
 {
 	const char *sprop;
-	int ret = 0;
+	int ret;
 	u32 val;
 	struct resource *res;
 	struct device_node *np2;
@@ -171,7 +171,7 @@ int ucc_of_parse_tdm(struct device_node *np, struct ucc_tdm *utdm,
 		siram_init_flag = 1;
 	}
 
-	return ret;
+	return 0;
 
 err_miss_siram_property:
 	return ret;
-- 
2.11.0


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

* Re: [PATCH 2/2] soc/fsl/qe: Slighly simplify code
  2017-08-20 15:53 [PATCH 2/2] soc/fsl/qe: Slighly simplify code Christophe JAILLET
@ 2017-08-20 19:11 ` walter harms
  2017-08-20 21:23 ` Marion & Christophe JAILLET
  1 sibling, 0 replies; 3+ messages in thread
From: walter harms @ 2017-08-20 19:11 UTC (permalink / raw)
  To: kernel-janitors



Am 20.08.2017 17:53, schrieb Christophe JAILLET:
> Return 0 instead of 'ret' (which is 0 at this point) to make the code more
> explicit.
> Also avoid a useless initialization of 'ret'.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/soc/fsl/qe/qe_tdm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/soc/fsl/qe/qe_tdm.c b/drivers/soc/fsl/qe/qe_tdm.c
> index 6b9647fee512..c90c72ca9e3e 100644
> --- a/drivers/soc/fsl/qe/qe_tdm.c
> +++ b/drivers/soc/fsl/qe/qe_tdm.c
> @@ -42,7 +42,7 @@ int ucc_of_parse_tdm(struct device_node *np, struct ucc_tdm *utdm,
>  		     struct ucc_tdm_info *ut_info)
>  {
>  	const char *sprop;
> -	int ret = 0;
> +	int ret;
>  	u32 val;
>  	struct resource *res;
>  	struct device_node *np2;
> @@ -171,7 +171,7 @@ int ucc_of_parse_tdm(struct device_node *np, struct ucc_tdm *utdm,
>  		siram_init_flag = 1;
>  	}
>  
> -	return ret;
> +	return 0;
>  
>  err_miss_siram_property:
>  	return ret;

This lonely return ret looks like a left over from some cleanup opperation.
Is there any reason why to use goto instead of a plain return ?

re,
 wh



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

* Re: [PATCH 2/2] soc/fsl/qe: Slighly simplify code
  2017-08-20 15:53 [PATCH 2/2] soc/fsl/qe: Slighly simplify code Christophe JAILLET
  2017-08-20 19:11 ` walter harms
@ 2017-08-20 21:23 ` Marion & Christophe JAILLET
  1 sibling, 0 replies; 3+ messages in thread
From: Marion & Christophe JAILLET @ 2017-08-20 21:23 UTC (permalink / raw)
  To: kernel-janitors



Le 20/08/2017 à 21:11, walter harms a écrit :
>
> Am 20.08.2017 17:53, schrieb Christophe JAILLET:
>> Return 0 instead of 'ret' (which is 0 at this point) to make the code more
>> explicit.
>> Also avoid a useless initialization of 'ret'.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>>   drivers/soc/fsl/qe/qe_tdm.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/soc/fsl/qe/qe_tdm.c b/drivers/soc/fsl/qe/qe_tdm.c
>> index 6b9647fee512..c90c72ca9e3e 100644
>> --- a/drivers/soc/fsl/qe/qe_tdm.c
>> +++ b/drivers/soc/fsl/qe/qe_tdm.c
>> @@ -42,7 +42,7 @@ int ucc_of_parse_tdm(struct device_node *np, struct ucc_tdm *utdm,
>>   		     struct ucc_tdm_info *ut_info)
>>   {
>>   	const char *sprop;
>> -	int ret = 0;
>> +	int ret;
>>   	u32 val;
>>   	struct resource *res;
>>   	struct device_node *np2;
>> @@ -171,7 +171,7 @@ int ucc_of_parse_tdm(struct device_node *np, struct ucc_tdm *utdm,
>>   		siram_init_flag = 1;
>>   	}
>>   
>> -	return ret;
>> +	return 0;
>>   
>>   err_miss_siram_property:
>>   	return ret;
> This lonely return ret looks like a left over from some cleanup opperation.
> Is there any reason why to use goto instead of a plain return ?
>
> re,
>   wh
>
I don't see any.

If agreed that the patch 1/2 which remove a devm_ function in the error 
handling path is correct, additional clean-ups could be performed as well.
    - direct return instead of branching to the err_miss_siram_property 
label
    - removing the err_miss_siram_property label
    - turning the:
         ret = -EINVAL;
         pr_err(<somtehing>);
         return ret;
      statements into:
         pr_err(<somtehing>);
         return -EINVAL;

Will propose it when/if 1/2 is confirmed.

Christophe

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

end of thread, other threads:[~2017-08-20 21:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-20 15:53 [PATCH 2/2] soc/fsl/qe: Slighly simplify code Christophe JAILLET
2017-08-20 19:11 ` walter harms
2017-08-20 21:23 ` Marion & Christophe JAILLET

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