public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Tobias Lorenz <tobias.lorenz@gmx.net>
Cc: Roel Kluin <roel.kluin@gmail.com>,
	linux-media@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] radio-si470x-common: -EINVAL overwritten in si470x_vidioc_s_tuner()
Date: Wed, 03 Feb 2010 23:34:36 -0200	[thread overview]
Message-ID: <4B6A242C.8060104@infradead.org> (raw)
In-Reply-To: <201002032252.36514.tobias.lorenz@gmx.net>

Tobias Lorenz wrote:
> Hello Roel,
> 
> no, the default value of retval makes no difference to the function.
> 
> Retval is set by si470x_disconnect_check and si470x_set_register.
> After each call, retval is checked.
> There is no need to reset it passed.
> 
> The only reason, there is a default value is my static code checker, saying variables should have default values.
> Setting it to -EINVAL seems more reasonable to me than setting it 0.
> In fact the patch would bring up the warning on setting default values again.

Well, your static code checker is then broken ;)

>>  	struct si470x_device *radio = video_drvdata(file);
>> -	int retval = -EINVAL;
>> +	int retval;
>>  
>>  	/* safety checks */
>>  	retval = si470x_disconnect_check(radio);

You may just do then:

	int retval = si470x_disconnect_check(radio);

>>  	if (retval)
>>  		goto done;
>> +	retval = -EINVAL;
>>  
>>  	if (tuner->index != 0)
>>  		goto done;
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 

Cheers,
Mauro

  reply	other threads:[~2010-02-04  1:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03 19:48 [PATCH] radio-si470x-common: -EINVAL overwritten in si470x_vidioc_s_tuner() Roel Kluin
2010-02-03 21:52 ` Tobias Lorenz
2010-02-04  1:34   ` Mauro Carvalho Chehab [this message]
2010-02-18 19:50     ` Tobias Lorenz
2010-02-24  5:12       ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B6A242C.8060104@infradead.org \
    --to=mchehab@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=roel.kluin@gmail.com \
    --cc=tobias.lorenz@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox