From: "Justin P. Mattock" <justinmattock@gmail.com>
To: Julian Calaby <julian.calaby@gmail.com>
Cc: linux-wireless@vger.kernel.org, j@w1.fi, linville@tuxdriver.com,
mcgrof@gmail.com
Subject: Re: [PATCH v3]hostap:hostap_ioctl.c Fix variable 'ret' set but not used
Date: Mon, 02 Aug 2010 20:44:13 -0700 [thread overview]
Message-ID: <4C57908D.2010904@gmail.com> (raw)
In-Reply-To: <AANLkTinbSvn=kjkvf1VceH3oLsScT5KxtwhSdfGuy5_a@mail.gmail.com>
On 08/02/2010 08:31 PM, Julian Calaby wrote:
> On Tue, Aug 3, 2010 at 12:49, Justin P. Mattock<justinmattock@gmail.com> wrote:
>> On 08/02/2010 07:31 PM, Julian Calaby wrote:
>>>
>>> On Tue, Aug 3, 2010 at 12:23, Justin P. Mattock<justinmattock@gmail.com>
>>> wrote:
>>>>
>>>> wait im lost.. looking at your patch looks the same(number wise) except I
>>>> see different parts of code in there:
>>>>
>>>> hostap_set_word(dev, HFA384X_RID_CNFROAMINGMODE,
>>>> HFA384X_ROAMING_FIRMWARE);
>>>>
>>>> - return 0;
>>>> + return ret;
>>>>
>>>>
>>>>
>>>> mine is:
>>>>
>>>> printk(KERN_DEBUG "SCANREQUEST failed\n");
>>>> - ret = -EINVAL;
>>>> + return ret;
>>>>
>>>>
>>>> The tree Im using is Linus's tree.
>>>
>>> I'm using wireless-testing, and the line you're changing is #1692, I'm
>>> changing #1699.
>>>
>>> Thanks,
>>>
>>
>>
>> ahh.. so there's two return ret's that need to be added then..
>> (if so then go ahead and take my patch and add it to yours.. I'm off to
>> other things)
>
> No.
>
> The function works like this:
>
> 1. set up scan_req
> 2. if local->host_roaming is not set, set host roaming on the hardware
> 3. set scan_req on the hardware
> 4. if local->host_roaming is not set, set the hardware to do firmware roaming
> 5. If set_req could not be set on the hardware, return -EINVAL,
> otherwise return 0.
>
> The significant bits are steps 2 and 4. These must *both* be executed,
> regardless of whether setting scan_req on the hardware succeeds or
> not.
>
> As such, the return value is stored in the ret variable, which is
> initialised to 0 initially, then set to -EINVAL if setting scan_req on
> the hardware fails. Hence, step 5 can be performed by returning ret.
>
> As such, all of your patches are wrong as they are either returning
> the wrong value when setting scan_req on the hardware fails, or
> failing to execute step 4. The *only* correct place to return a value
> is once the roaming status of the hardware has been set properly -
> i.e. at the end of the function.
>
> I hope this has cleared up your confusion.
>
> Thanks,
>
cleared it up perfectly... didnt think that using ret down more would
work..(was stuck a few lines up) but it does.. just tested your version
out and no warning messages..
cheers,
Justin P. Mattock
prev parent reply other threads:[~2010-08-03 3:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-03 1:46 [PATCH v3]hostap:hostap_ioctl.c Fix variable 'ret' set but not used Justin P. Mattock
2010-08-03 1:58 ` Julian Calaby
2010-08-03 2:23 ` Justin P. Mattock
2010-08-03 2:31 ` Julian Calaby
2010-08-03 2:49 ` Justin P. Mattock
2010-08-03 3:31 ` Julian Calaby
2010-08-03 3:44 ` Justin P. Mattock [this message]
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=4C57908D.2010904@gmail.com \
--to=justinmattock@gmail.com \
--cc=j@w1.fi \
--cc=julian.calaby@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mcgrof@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).