lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 29 Dec 2015 11:11:02 +0700
From:	Ivan Safonov <insafonov@...il.com>
To:	Joe Perches <joe@...ches.com>,
	QCA ath9k Development <ath9k-devel@....qualcomm.com>
Cc:	Kalle Valo <kvalo@...eaurora.org>, linux-wireless@...r.kernel.org,
	ath9k-devel@...ts.ath9k.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] /drivers/net/wireless/ath/ath9k remove unnecessary ?:
 operator

On 12/29/2015 07:31 AM, Joe Perches wrote:
> On Tue, 2015-12-29 at 01:38 +0700, Ivan Safonov wrote:
>> On 12/29/2015 12:56 AM, Joe Perches wrote:
>>> On Mon, 2015-12-28 at 20:48 +0700, Ivan Safonov wrote:
>>>> ((thermometer < 0) ? 0 : (thermometer == X)) and (thermometer ==
>>>> X) are equal for X >= 0.
>>> X is not guaranteed to be >= 0 here
>> X is fixed constant. In this case X is {0, 1, 2}.
> Looks like it can be -1 to me (range: -1, 0, 1, 2)
>
> static int ar9003_hw_get_thermometer(struct ath_hw *ah)
> {
> 	struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
> 	struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;
> 	int thermometer =  (pBase->miscConfiguration >> 1) & 0x3;
>
> 	return --thermometer;
> }

X is not thermometer. The thermometer is {-1, 0, 1, 2}. X is {0, 1, 2}.
All possible X valueswritten in the comments:

ar9003_hw_get_thermometer used only in ar9003_hw_thermometer_apply:

     static void ar9003_hw_thermometer_apply(struct ath_hw *ah)
     {
         struct ath9k_hw_capabilities *pCap = &ah->caps;
         int thermometer = ar9003_hw_get_thermometer(ah);
         u8 therm_on = (thermometer < 0) ? 0 : 1;

         REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_RXTX4,
                   AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR, therm_on);
         if (pCap->chip_chainmask & BIT(1))
             REG_RMW_FIELD(ah, AR_PHY_65NM_CH1_RXTX4,
                       AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR, therm_on);
         if (pCap->chip_chainmask & BIT(2))
             REG_RMW_FIELD(ah, AR_PHY_65NM_CH2_RXTX4,
                       AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR, therm_on);

         therm_on = (thermometer < 0) ? 0 : (thermometer == 0); /* X = 0 */
         REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_RXTX4,
                   AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on);
         if (pCap->chip_chainmask & BIT(1)) {
             therm_on = (thermometer < 0) ? 0 : (thermometer == 1);    
/* X = 1 */
             REG_RMW_FIELD(ah, AR_PHY_65NM_CH1_RXTX4,
                       AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on);
         }
         if (pCap->chip_chainmask & BIT(2)) {
             therm_on = (thermometer < 0) ? 0 : (thermometer == 2);    
/* X = 2 */
             REG_RMW_FIELD(ah, AR_PHY_65NM_CH2_RXTX4,
                       AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on);
         }
     }

There is no X = -1.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists