All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] gpu: host1x: simplify the return expression of host1x_cdma_init()
@ 2020-09-21 13:10 ` Qinglang Miao
  0 siblings, 0 replies; 8+ messages in thread
From: Qinglang Miao @ 2020-09-21 13:10 UTC (permalink / raw)
  To: Thierry Reding; +Cc: dri-devel, linux-tegra, linux-kernel, Qinglang Miao

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
 drivers/gpu/host1x/cdma.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
index e8d3fda91..08a0f9e10 100644
--- a/drivers/gpu/host1x/cdma.c
+++ b/drivers/gpu/host1x/cdma.c
@@ -448,8 +448,6 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
  */
 int host1x_cdma_init(struct host1x_cdma *cdma)
 {
-	int err;
-
 	mutex_init(&cdma->lock);
 	init_completion(&cdma->complete);
 
@@ -459,11 +457,7 @@ int host1x_cdma_init(struct host1x_cdma *cdma)
 	cdma->running = false;
 	cdma->torndown = false;
 
-	err = host1x_pushbuffer_init(&cdma->push_buffer);
-	if (err)
-		return err;
-
-	return 0;
+	return host1x_pushbuffer_init(&cdma->push_buffer);
 }
 
 /*
-- 
2.23.0


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

* [PATCH -next] gpu: host1x: simplify the return expression of host1x_cdma_init()
@ 2020-09-21 13:10 ` Qinglang Miao
  0 siblings, 0 replies; 8+ messages in thread
From: Qinglang Miao @ 2020-09-21 13:10 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-tegra, Qinglang Miao, linux-kernel, dri-devel

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
 drivers/gpu/host1x/cdma.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
index e8d3fda91..08a0f9e10 100644
--- a/drivers/gpu/host1x/cdma.c
+++ b/drivers/gpu/host1x/cdma.c
@@ -448,8 +448,6 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
  */
 int host1x_cdma_init(struct host1x_cdma *cdma)
 {
-	int err;
-
 	mutex_init(&cdma->lock);
 	init_completion(&cdma->complete);
 
@@ -459,11 +457,7 @@ int host1x_cdma_init(struct host1x_cdma *cdma)
 	cdma->running = false;
 	cdma->torndown = false;
 
-	err = host1x_pushbuffer_init(&cdma->push_buffer);
-	if (err)
-		return err;
-
-	return 0;
+	return host1x_pushbuffer_init(&cdma->push_buffer);
 }
 
 /*
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH -next] gpu: host1x: simplify the return expression of host1x_cdma_init()
  2020-09-21 13:10 ` Qinglang Miao
@ 2020-09-21 13:12   ` Mikko Perttunen
  -1 siblings, 0 replies; 8+ messages in thread
From: Mikko Perttunen @ 2020-09-21 13:12 UTC (permalink / raw)
  To: Qinglang Miao, Thierry Reding; +Cc: dri-devel, linux-tegra, linux-kernel

On 9/21/20 4:10 PM, Qinglang Miao wrote:
> Simplify the return expression.
> 
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> ---
>   drivers/gpu/host1x/cdma.c | 8 +-------
>   1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
> index e8d3fda91..08a0f9e10 100644
> --- a/drivers/gpu/host1x/cdma.c
> +++ b/drivers/gpu/host1x/cdma.c
> @@ -448,8 +448,6 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>    */
>   int host1x_cdma_init(struct host1x_cdma *cdma)
>   {
> -	int err;
> -
>   	mutex_init(&cdma->lock);
>   	init_completion(&cdma->complete);
>   
> @@ -459,11 +457,7 @@ int host1x_cdma_init(struct host1x_cdma *cdma)
>   	cdma->running = false;
>   	cdma->torndown = false;
>   
> -	err = host1x_pushbuffer_init(&cdma->push_buffer);
> -	if (err)
> -		return err;
> -
> -	return 0;
> +	return host1x_pushbuffer_init(&cdma->push_buffer);

IMHO, this makes it less readable since now it kind of looks like 
host1x_pushbuffer_init is returning some meaningful value, instead of 
the code just handling error values in a sequence.

Mikko

>   }
>   
>   /*
> 

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

* Re: [PATCH -next] gpu: host1x: simplify the return expression of host1x_cdma_init()
@ 2020-09-21 13:12   ` Mikko Perttunen
  0 siblings, 0 replies; 8+ messages in thread
From: Mikko Perttunen @ 2020-09-21 13:12 UTC (permalink / raw)
  To: Qinglang Miao, Thierry Reding; +Cc: linux-tegra, linux-kernel, dri-devel

On 9/21/20 4:10 PM, Qinglang Miao wrote:
> Simplify the return expression.
> 
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> ---
>   drivers/gpu/host1x/cdma.c | 8 +-------
>   1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
> index e8d3fda91..08a0f9e10 100644
> --- a/drivers/gpu/host1x/cdma.c
> +++ b/drivers/gpu/host1x/cdma.c
> @@ -448,8 +448,6 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>    */
>   int host1x_cdma_init(struct host1x_cdma *cdma)
>   {
> -	int err;
> -
>   	mutex_init(&cdma->lock);
>   	init_completion(&cdma->complete);
>   
> @@ -459,11 +457,7 @@ int host1x_cdma_init(struct host1x_cdma *cdma)
>   	cdma->running = false;
>   	cdma->torndown = false;
>   
> -	err = host1x_pushbuffer_init(&cdma->push_buffer);
> -	if (err)
> -		return err;
> -
> -	return 0;
> +	return host1x_pushbuffer_init(&cdma->push_buffer);

IMHO, this makes it less readable since now it kind of looks like 
host1x_pushbuffer_init is returning some meaningful value, instead of 
the code just handling error values in a sequence.

Mikko

>   }
>   
>   /*
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH -next] gpu: host1x: simplify the return expression of host1x_cdma_init()
  2020-09-21 13:12   ` Mikko Perttunen
@ 2020-09-21 13:27     ` Thierry Reding
  -1 siblings, 0 replies; 8+ messages in thread
From: Thierry Reding @ 2020-09-21 13:27 UTC (permalink / raw)
  To: Mikko Perttunen; +Cc: Qinglang Miao, dri-devel, linux-tegra, linux-kernel

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

On Mon, Sep 21, 2020 at 04:12:20PM +0300, Mikko Perttunen wrote:
> On 9/21/20 4:10 PM, Qinglang Miao wrote:
> > Simplify the return expression.
> > 
> > Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> > ---
> >   drivers/gpu/host1x/cdma.c | 8 +-------
> >   1 file changed, 1 insertion(+), 7 deletions(-)
> > 
> > diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
> > index e8d3fda91..08a0f9e10 100644
> > --- a/drivers/gpu/host1x/cdma.c
> > +++ b/drivers/gpu/host1x/cdma.c
> > @@ -448,8 +448,6 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
> >    */
> >   int host1x_cdma_init(struct host1x_cdma *cdma)
> >   {
> > -	int err;
> > -
> >   	mutex_init(&cdma->lock);
> >   	init_completion(&cdma->complete);
> > @@ -459,11 +457,7 @@ int host1x_cdma_init(struct host1x_cdma *cdma)
> >   	cdma->running = false;
> >   	cdma->torndown = false;
> > -	err = host1x_pushbuffer_init(&cdma->push_buffer);
> > -	if (err)
> > -		return err;
> > -
> > -	return 0;
> > +	return host1x_pushbuffer_init(&cdma->push_buffer);
> 
> IMHO, this makes it less readable since now it kind of looks like
> host1x_pushbuffer_init is returning some meaningful value, instead of the
> code just handling error values in a sequence.

Agreed. Collapsing the error handling like this also makes adding code
to the bottom of this function more complicated than necessary.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH -next] gpu: host1x: simplify the return expression of host1x_cdma_init()
@ 2020-09-21 13:27     ` Thierry Reding
  0 siblings, 0 replies; 8+ messages in thread
From: Thierry Reding @ 2020-09-21 13:27 UTC (permalink / raw)
  To: Mikko Perttunen; +Cc: linux-tegra, dri-devel, Qinglang Miao, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1432 bytes --]

On Mon, Sep 21, 2020 at 04:12:20PM +0300, Mikko Perttunen wrote:
> On 9/21/20 4:10 PM, Qinglang Miao wrote:
> > Simplify the return expression.
> > 
> > Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> > ---
> >   drivers/gpu/host1x/cdma.c | 8 +-------
> >   1 file changed, 1 insertion(+), 7 deletions(-)
> > 
> > diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
> > index e8d3fda91..08a0f9e10 100644
> > --- a/drivers/gpu/host1x/cdma.c
> > +++ b/drivers/gpu/host1x/cdma.c
> > @@ -448,8 +448,6 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
> >    */
> >   int host1x_cdma_init(struct host1x_cdma *cdma)
> >   {
> > -	int err;
> > -
> >   	mutex_init(&cdma->lock);
> >   	init_completion(&cdma->complete);
> > @@ -459,11 +457,7 @@ int host1x_cdma_init(struct host1x_cdma *cdma)
> >   	cdma->running = false;
> >   	cdma->torndown = false;
> > -	err = host1x_pushbuffer_init(&cdma->push_buffer);
> > -	if (err)
> > -		return err;
> > -
> > -	return 0;
> > +	return host1x_pushbuffer_init(&cdma->push_buffer);
> 
> IMHO, this makes it less readable since now it kind of looks like
> host1x_pushbuffer_init is returning some meaningful value, instead of the
> code just handling error values in a sequence.

Agreed. Collapsing the error handling like this also makes adding code
to the bottom of this function more complicated than necessary.

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH -next] gpu: host1x: simplify the return expression of host1x_cdma_init()
  2020-09-21 13:12   ` Mikko Perttunen
@ 2020-09-22  2:33     ` miaoqinglang
  -1 siblings, 0 replies; 8+ messages in thread
From: miaoqinglang @ 2020-09-22  2:33 UTC (permalink / raw)
  To: Mikko Perttunen, Thierry Reding; +Cc: dri-devel, linux-tegra, linux-kernel



在 2020/9/21 21:12, Mikko Perttunen 写道:
> On 9/21/20 4:10 PM, Qinglang Miao wrote:
>> Simplify the return expression.
>>
>> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
>> ---
>>   drivers/gpu/host1x/cdma.c | 8 +-------
>>   1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
>> index e8d3fda91..08a0f9e10 100644
>> --- a/drivers/gpu/host1x/cdma.c
>> +++ b/drivers/gpu/host1x/cdma.c
>> @@ -448,8 +448,6 @@ void host1x_cdma_update_sync_queue(struct 
>> host1x_cdma *cdma,
>>    */
>>   int host1x_cdma_init(struct host1x_cdma *cdma)
>>   {
>> -    int err;
>> -
>>       mutex_init(&cdma->lock);
>>       init_completion(&cdma->complete);
>> @@ -459,11 +457,7 @@ int host1x_cdma_init(struct host1x_cdma *cdma)
>>       cdma->running = false;
>>       cdma->torndown = false;
>> -    err = host1x_pushbuffer_init(&cdma->push_buffer);
>> -    if (err)
>> -        return err;
>> -
>> -    return 0;
>> +    return host1x_pushbuffer_init(&cdma->push_buffer);
> 
> IMHO, this makes it less readable since now it kind of looks like 
> host1x_pushbuffer_init is returning some meaningful value, instead of 
> the code just handling error values in a sequence.
> 
> Mikko
> 
Hi Mikko,

It sounds resonable, thanks for your reply.

>>   }
>>   /*
>>
> .

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

* Re: [PATCH -next] gpu: host1x: simplify the return expression of host1x_cdma_init()
@ 2020-09-22  2:33     ` miaoqinglang
  0 siblings, 0 replies; 8+ messages in thread
From: miaoqinglang @ 2020-09-22  2:33 UTC (permalink / raw)
  To: Mikko Perttunen, Thierry Reding; +Cc: linux-tegra, linux-kernel, dri-devel



在 2020/9/21 21:12, Mikko Perttunen 写道:
> On 9/21/20 4:10 PM, Qinglang Miao wrote:
>> Simplify the return expression.
>>
>> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
>> ---
>>   drivers/gpu/host1x/cdma.c | 8 +-------
>>   1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
>> index e8d3fda91..08a0f9e10 100644
>> --- a/drivers/gpu/host1x/cdma.c
>> +++ b/drivers/gpu/host1x/cdma.c
>> @@ -448,8 +448,6 @@ void host1x_cdma_update_sync_queue(struct 
>> host1x_cdma *cdma,
>>    */
>>   int host1x_cdma_init(struct host1x_cdma *cdma)
>>   {
>> -    int err;
>> -
>>       mutex_init(&cdma->lock);
>>       init_completion(&cdma->complete);
>> @@ -459,11 +457,7 @@ int host1x_cdma_init(struct host1x_cdma *cdma)
>>       cdma->running = false;
>>       cdma->torndown = false;
>> -    err = host1x_pushbuffer_init(&cdma->push_buffer);
>> -    if (err)
>> -        return err;
>> -
>> -    return 0;
>> +    return host1x_pushbuffer_init(&cdma->push_buffer);
> 
> IMHO, this makes it less readable since now it kind of looks like 
> host1x_pushbuffer_init is returning some meaningful value, instead of 
> the code just handling error values in a sequence.
> 
> Mikko
> 
Hi Mikko,

It sounds resonable, thanks for your reply.

>>   }
>>   /*
>>
> .
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

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

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-21 13:10 [PATCH -next] gpu: host1x: simplify the return expression of host1x_cdma_init() Qinglang Miao
2020-09-21 13:10 ` Qinglang Miao
2020-09-21 13:12 ` Mikko Perttunen
2020-09-21 13:12   ` Mikko Perttunen
2020-09-21 13:27   ` Thierry Reding
2020-09-21 13:27     ` Thierry Reding
2020-09-22  2:33   ` miaoqinglang
2020-09-22  2:33     ` miaoqinglang

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.