Thread (5 messages) flat view 5 messages, 2 authors, 2015-12-29

Re: [PATCH] /drivers/net/wireless/ath/ath9k remove unnecessary ?: operator

From: Joe Perches <joe@perches.com>
Date: 2015-12-29 00:31:29
Also in: lkml, netdev

On Tue, 2015-12-29 at 01:38 +0700, Ivan Safonov wrote:
On 12/29/2015 12:56 AM, Joe Perches wrote:
quoted
On Mon, 2015-12-28 at 20:48 +0700, Ivan Safonov wrote:
quoted
((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;
}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help