Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1317045 > unrolled thread

Re: [PATCH 1/2] [media] m88rs6000t: Better exception handling in five functions

Started byMauro Carvalho Chehab <mchehab@osg.samsung.com>
First post2016-01-25 18:10 +0100
Last post2016-01-25 19:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/2] [media] m88rs6000t: Better exception handling in  five functions Mauro Carvalho Chehab <mchehab@osg.samsung.com> - 2016-01-25 18:10 +0100
    Re: [PATCH 1/2] [media] m88rs6000t: Better exception handling in five  functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-25 19:30 +0100

#1317045 — Re: [PATCH 1/2] [media] m88rs6000t: Better exception handling in five functions

FromMauro Carvalho Chehab <mchehab@osg.samsung.com>
Date2016-01-25 18:10 +0100
SubjectRe: [PATCH 1/2] [media] m88rs6000t: Better exception handling in five functions
Message-ID<qUSOn-7cE-33@gated-at.bofh.it>
Em Mon, 28 Dec 2015 15:38:54 +0100
SF Markus Elfring <elfring@users.sourceforge.net> escreveu:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 28 Dec 2015 15:10:30 +0100
> 
> This issue was detected by using the Coccinelle software.
> 
> Move the jump label directly before the desired log statement
> so that the variable "ret" will not be checked once more
> after a function call.
> Use the identifier "report_failure" instead of "err".
> 
> Suggested-by: Julia Lawall <julia.lawall@lip6.fr>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/media/tuners/m88rs6000t.c | 154 +++++++++++++++++++-------------------
>  1 file changed, 78 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/media/tuners/m88rs6000t.c b/drivers/media/tuners/m88rs6000t.c
> index 504bfbc..7e59a9f 100644
> --- a/drivers/media/tuners/m88rs6000t.c
> +++ b/drivers/media/tuners/m88rs6000t.c
> @@ -44,7 +44,7 @@ static int m88rs6000t_set_demod_mclk(struct dvb_frontend *fe)
>  	/* select demod main mclk */
>  	ret = regmap_read(dev->regmap, 0x15, &utmp);
>  	if (ret)
> -		goto err;
> +		goto report_failure;

Why to be so verbose? Calling it as "err" is enough, and it means less
code to type if we need to add another goto.

Regards,
Mauro

[toc] | [next] | [standalone]


#1317150 — Re: [PATCH 1/2] [media] m88rs6000t: Better exception handling in five functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-01-25 19:30 +0100
SubjectRe: [PATCH 1/2] [media] m88rs6000t: Better exception handling in five functions
Message-ID<qUU3N-830-47@gated-at.bofh.it>
In reply to#1317045
>> This issue was detected by using the Coccinelle software.
>>
>> Move the jump label directly before the desired log statement
>> so that the variable "ret" will not be checked once more
>> after a function call.
>> Use the identifier "report_failure" instead of "err".
>>
>> Suggested-by: Julia Lawall <julia.lawall@lip6.fr>
>> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
>> ---
>>  drivers/media/tuners/m88rs6000t.c | 154 +++++++++++++++++++-------------------
>>  1 file changed, 78 insertions(+), 76 deletions(-)
>>
>> diff --git a/drivers/media/tuners/m88rs6000t.c b/drivers/media/tuners/m88rs6000t.c
>> index 504bfbc..7e59a9f 100644
>> --- a/drivers/media/tuners/m88rs6000t.c
>> +++ b/drivers/media/tuners/m88rs6000t.c
>> @@ -44,7 +44,7 @@ static int m88rs6000t_set_demod_mclk(struct dvb_frontend *fe)
>>  	/* select demod main mclk */
>>  	ret = regmap_read(dev->regmap, 0x15, &utmp);
>>  	if (ret)
>> -		goto err;
>> +		goto report_failure;
> 
> Why to be so verbose?

Does the document "CodingStyle" give an indication in the section "Chapter 7:
Centralized exiting of functions"?


> Calling it as "err" is enough,

It seems that some short identifiers are popular during software development.


> and it means less code to type if we need to add another goto.

Would you like to increase the usage of jump labels which will contain
only a single character?

Regards,
Markus

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web