linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] drm: omapdrm: dss: simplify the return expression of hdmi_init_pll_data
@ 2020-09-21 13:10 Qinglang Miao
  2020-09-21 13:39 ` Tomi Valkeinen
  0 siblings, 1 reply; 3+ messages in thread
From: Qinglang Miao @ 2020-09-21 13:10 UTC (permalink / raw)
  To: Tomi Valkeinen, David Airlie, Daniel Vetter
  Cc: dri-devel, linux-kernel, Qinglang Miao

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
 drivers/gpu/drm/omapdrm/dss/hdmi_pll.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
index cf2b000f3..c3e85b636 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
@@ -131,7 +131,6 @@ static int hdmi_init_pll_data(struct dss_device *dss,
 {
 	struct dss_pll *pll = &hpll->pll;
 	struct clk *clk;
-	int r;
 
 	clk = devm_clk_get(&pdev->dev, "sys_clk");
 	if (IS_ERR(clk)) {
@@ -151,11 +150,7 @@ static int hdmi_init_pll_data(struct dss_device *dss,
 
 	pll->ops = &hdmi_pll_ops;
 
-	r = dss_pll_register(dss, pll);
-	if (r)
-		return r;
-
-	return 0;
+	return dss_pll_register(dss, pll);
 }
 
 int hdmi_pll_init(struct dss_device *dss, struct platform_device *pdev,
-- 
2.23.0


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

* Re: [PATCH -next] drm: omapdrm: dss: simplify the return expression of hdmi_init_pll_data
  2020-09-21 13:10 [PATCH -next] drm: omapdrm: dss: simplify the return expression of hdmi_init_pll_data Qinglang Miao
@ 2020-09-21 13:39 ` Tomi Valkeinen
  2020-09-22  2:32   ` miaoqinglang
  0 siblings, 1 reply; 3+ messages in thread
From: Tomi Valkeinen @ 2020-09-21 13:39 UTC (permalink / raw)
  To: Qinglang Miao, David Airlie, Daniel Vetter; +Cc: dri-devel, linux-kernel

Hi,

On 21/09/2020 16:10, Qinglang Miao wrote:
> Simplify the return expression.
> 
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/hdmi_pll.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
> index cf2b000f3..c3e85b636 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
> @@ -131,7 +131,6 @@ static int hdmi_init_pll_data(struct dss_device *dss,
>  {
>  	struct dss_pll *pll = &hpll->pll;
>  	struct clk *clk;
> -	int r;
>  
>  	clk = devm_clk_get(&pdev->dev, "sys_clk");
>  	if (IS_ERR(clk)) {
> @@ -151,11 +150,7 @@ static int hdmi_init_pll_data(struct dss_device *dss,
>  
>  	pll->ops = &hdmi_pll_ops;
>  
> -	r = dss_pll_register(dss, pll);
> -	if (r)
> -		return r;
> -
> -	return 0;
> +	return dss_pll_register(dss, pll);
>  }
>  
>  int hdmi_pll_init(struct dss_device *dss, struct platform_device *pdev,
> 

I like it more when there's a return 0 at the end of the function, especially in functions where
there are multiple cases of if(...) return r. It's more easily readable, at least to my eyes.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH -next] drm: omapdrm: dss: simplify the return expression of hdmi_init_pll_data
  2020-09-21 13:39 ` Tomi Valkeinen
@ 2020-09-22  2:32   ` miaoqinglang
  0 siblings, 0 replies; 3+ messages in thread
From: miaoqinglang @ 2020-09-22  2:32 UTC (permalink / raw)
  To: Tomi Valkeinen, David Airlie, Daniel Vetter; +Cc: dri-devel, linux-kernel



在 2020/9/21 21:39, Tomi Valkeinen 写道:
> Hi,
> 
> On 21/09/2020 16:10, Qinglang Miao wrote:
>> Simplify the return expression.
>>
>> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
>> ---
>>   drivers/gpu/drm/omapdrm/dss/hdmi_pll.c | 7 +------
>>   1 file changed, 1 insertion(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
>> index cf2b000f3..c3e85b636 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
>> @@ -131,7 +131,6 @@ static int hdmi_init_pll_data(struct dss_device *dss,
>>   {
>>   	struct dss_pll *pll = &hpll->pll;
>>   	struct clk *clk;
>> -	int r;
>>   
>>   	clk = devm_clk_get(&pdev->dev, "sys_clk");
>>   	if (IS_ERR(clk)) {
>> @@ -151,11 +150,7 @@ static int hdmi_init_pll_data(struct dss_device *dss,
>>   
>>   	pll->ops = &hdmi_pll_ops;
>>   
>> -	r = dss_pll_register(dss, pll);
>> -	if (r)
>> -		return r;
>> -
>> -	return 0;
>> +	return dss_pll_register(dss, pll);
>>   }
>>   
>>   int hdmi_pll_init(struct dss_device *dss, struct platform_device *pdev,
>>
> 
> I like it more when there's a return 0 at the end of the function, especially in functions where
> there are multiple cases of if(...) return r. It's more easily readable, at least to my eyes.
> 
>   Tomi

Hi Tomi,

Glad to know your opnion and it sounds fine to me.

Thanks

> 

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

end of thread, other threads:[~2020-09-22  2:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 13:10 [PATCH -next] drm: omapdrm: dss: simplify the return expression of hdmi_init_pll_data Qinglang Miao
2020-09-21 13:39 ` Tomi Valkeinen
2020-09-22  2:32   ` miaoqinglang

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).