Re: [ath9k-devel] [patch -next] ath9k: fix ath9k_hw_nvram_check_version()

2016-01-07 Thread Kalle Valo
Dan Carpenter  writes:

> There is a type bug so it always returns success.
>
> Fixes: 6fa658fd5ab2 ('ath9k: Simplify and fix eeprom endianness swapping')
> Signed-off-by: Dan Carpenter 

Applied to ath.git, thanks.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [patch -next] ath9k: fix ath9k_hw_nvram_check_version()

2015-12-20 Thread Joe Perches
On Sat, 2015-12-19 at 13:59 +0300, Dan Carpenter wrote:
> There is a type bug so it always returns success.

How many false positives do you have to sift
through to find this sort of error?

> +++ b/drivers/net/wireless/ath/ath9k/eeprom.c
> @@ -206,7 +206,7 @@ bool ath9k_hw_nvram_check_version(struct ath_hw *ah, int 
> version, int minrev)
>   ath_err(common, "Bad EEPROM VER 0x%04x or REV 0x%04x\n",
>   ah->eep_ops->get_eeprom_ver(ah),
>   ah->eep_ops->get_eeprom_rev(ah));
> - return -EINVAL;
> + return false;
>   }
>  
>   return true;

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [patch -next] ath9k: fix ath9k_hw_nvram_check_version()

2015-12-20 Thread Joe Perches
On Sun, 2015-12-20 at 20:00 +0100, Julia Lawall wrote:
> On Sun, 20 Dec 2015, Joe Perches wrote:
> 
> > On Sat, 2015-12-19 at 13:59 +0300, Dan Carpenter wrote:
> > > There is a type bug so it always returns success.
> > 
> > How many false positives do you have to sift
> > through to find this sort of error?
> 
> The return type is thoughtfully bool, so it should be easy in this case.  
> The function has a return -EINVAL and a return true, so even without the 
> return type it would be locally apparent that there is an inconsistency.

True, -EINVAL is a non-bool constant, but
bool returns can be a variable int.

Dan, was the check any constant non-bool?

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [patch -next] ath9k: fix ath9k_hw_nvram_check_version()

2015-12-20 Thread Dan Carpenter
On Sun, Dec 20, 2015 at 11:05:55AM -0800, Joe Perches wrote:
> On Sun, 2015-12-20 at 20:00 +0100, Julia Lawall wrote:
> > On Sun, 20 Dec 2015, Joe Perches wrote:
> > 
> > > On Sat, 2015-12-19 at 13:59 +0300, Dan Carpenter wrote:
> > > > There is a type bug so it always returns success.
> > > 
> > > How many false positives do you have to sift
> > > through to find this sort of error?
> > 
> > The return type is thoughtfully bool, so it should be easy in this case.  
> > The function has a return -EINVAL and a return true, so even without the 
> > return type it would be locally apparent that there is an inconsistency.
> 
> True, -EINVAL is a non-bool constant, but
> bool returns can be a variable int.
> 
> Dan, was the check any constant non-bool?

This warning is for returning negative with unsigned types smaller than
int.  It's doing cross function flow analysis so it could warning about
other things besides constants, but it's 90% constants.  It warns
about ds2482_w1_triplet() for example.

There aren't many false positives.

regards,
dan carpenter

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [patch -next] ath9k: fix ath9k_hw_nvram_check_version()

2015-12-19 Thread Dan Carpenter
There is a type bug so it always returns success.

Fixes: 6fa658fd5ab2 ('ath9k: Simplify and fix eeprom endianness swapping')
Signed-off-by: Dan Carpenter 

diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c 
b/drivers/net/wireless/ath/ath9k/eeprom.c
index f8c5065..a7afdee 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -206,7 +206,7 @@ bool ath9k_hw_nvram_check_version(struct ath_hw *ah, int 
version, int minrev)
ath_err(common, "Bad EEPROM VER 0x%04x or REV 0x%04x\n",
ah->eep_ops->get_eeprom_ver(ah),
ah->eep_ops->get_eeprom_rev(ah));
-   return -EINVAL;
+   return false;
}
 
return true;
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel