[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFo99gbsds_O12h+9FOayvdODxRNeKUKXUs1_XjszFfr8yjR2Q@mail.gmail.com>
Date: Sat, 7 Jun 2014 13:52:59 +0200
From: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To: Joe Perches <joe@...ches.com>
Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@...el.com>,
linux-wimax@...el.com,
Network Development <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: wimax: i2400m: control.c: Cleaning up conjunction
always evaluates to false
Hi
Thought about it, and now it becomes clearer.
But if someone decides to change the X or Y to a larger range than 1
and 2, it will not be correct ..?
Or, will it not happen?
But I'm no expert on this code :)
I just wanted to point out the logical error.
Best regards
Rickard Strandqvist
2014-06-07 13:42 GMT+02:00 Joe Perches <joe@...ches.com>:
> On Sat, 2014-06-07 at 13:26 +0200, Rickard Strandqvist wrote:
>> Logical conjunction always evaluates to false: minor < 2 && minor > 1
>> I guess what you wanted is rather: minor > 2 || minor < 1
> []
>> diff --git a/drivers/net/wimax/i2400m/control.c b/drivers/net/wimax/i2400m/control.c
> []
>> @@ -1061,7 +1061,7 @@ int i2400m_firmware_check(struct i2400m *i2400m)
>> goto error_bad_major;
>> }
>> result = 0;
>> - if (minor < I2400M_HDIv_MINOR_2 && minor > I2400M_HDIv_MINOR)
>> + if (minor > I2400M_HDIv_MINOR_2 || minor < I2400M_HDIv_MINOR)
>
> perhaps clearer as:
>
> if (!(minor == I2400M_HDIv_MINOR || minor == I2400M_HDIv_MINOR_2))
>
>> dev_warn(dev, "untested minor fw version %u.%u.%u\n",
>> major, minor, branch);
>> /* Yes, we ignore the branch -- we don't have to track it */
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists