Skip to contentSkip to conversation

Remove double test

PATCH In review Julia Lawall 10 participants 26 messages Aug 28, 2010 – Sep 3, 2010

Subsystems (10)
lore
Share & tools
lore
#0 lore raw

cover Remove double test

These patches fix a case where the same expression is tested twice and the answer is guaranteed to be the same in each case.

#1 lore raw

PATCH 1/7 drivers/staging: Remove double test

The 1 element of the array is tested twice. Change the code so that the remaining 3 element of the array is tested instead of testing the 1 element a second time.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

  || ... || E
|

* E
&& ... && E
)
// </smpl>

---
This is just as guess as to what the correct code should be.

 drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c  |    2 +-
 drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c |    2 +-
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c  |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c +1 -1
index aaf9b9d..9318695 100644
@@ -2579,7 +2579,7 @@ static inline void update_network(struct ieee80211_network *dst,
 	if(src->wmm_param[0].ac_aci_acm_aifsn|| \
 	   src->wmm_param[1].ac_aci_acm_aifsn|| \
 	   src->wmm_param[2].ac_aci_acm_aifsn|| \
-	   src->wmm_param[1].ac_aci_acm_aifsn) {
+	   src->wmm_param[3].ac_aci_acm_aifsn) {
 	  memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN);
 	}
 	//dst->QoS_Enable = src->QoS_Enable;
drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c +1 -1
index 09a02f7..7230cf5 100644
@@ -2298,7 +2298,7 @@ static inline void update_network(struct ieee80211_network *dst,
 	if(src->wmm_param[0].ac_aci_acm_aifsn|| \
 	   src->wmm_param[1].ac_aci_acm_aifsn|| \
 	   src->wmm_param[2].ac_aci_acm_aifsn|| \
-	   src->wmm_param[1].ac_aci_acm_aifsn) {
+	   src->wmm_param[3].ac_aci_acm_aifsn) {
 	  memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN);
 	}
 	//dst->QoS_Enable = src->QoS_Enable;
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +1 -1
index 192123f..c8ca9d8 100644
@@ -2391,7 +2391,7 @@ static inline void update_network(struct ieee80211_network *dst,
 	if(src->wmm_param[0].ac_aci_acm_aifsn|| \
 	   src->wmm_param[1].ac_aci_acm_aifsn|| \
 	   src->wmm_param[2].ac_aci_acm_aifsn|| \
-	   src->wmm_param[1].ac_aci_acm_aifsn) {
+	   src->wmm_param[3].ac_aci_acm_aifsn) {
 	  memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN);
 	}
 	//dst->QoS_Enable = src->QoS_Enable;
#2 lore raw

PATCH 2/7 drivers/usb/gadget: Remove double test

In reply to Julia Lawall

The same expression is tested twice and the result is the same each time.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

  || ... || E
|

* E
&& ... && E
)
// </smpl>

---
This is a guess as to what the code should be. Perhaps something else should have been tested instead.

 drivers/usb/gadget/amd5536udc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/amd5536udc.c +1 -1
index 731150d..6c40c99 100644
@@ -203,7 +203,7 @@ static void print_regs(struct udc *dev)
 		DBG(dev, "DMA mode       = PPBNDU (packet per buffer "
 			"WITHOUT desc. update)\n");
 		dev_info(&dev->pdev->dev, "DMA mode (%s)\n", "PPBNDU");
-	} else if (use_dma && use_dma_ppb_du && use_dma_ppb_du) {
+	} else if (use_dma && use_dma_ppb_du) {
 		DBG(dev, "DMA mode       = PPBDU (packet per buffer "
 			"WITH desc. update)\n");
 		dev_info(&dev->pdev->dev, "DMA mode (%s)\n", "PPBDU");
#14 lore raw

PATCH 3/7 drivers/net/atl1c: Remove double test

In reply to Julia Lawall

The nic_type field is compared to athr_l2c twice.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

  || ... || E
|

* E
&& ... && E
)
// </smpl>

---
This is a guess as to what the code should be. Perhaps something else should have been tested instead.

 drivers/net/atl1c/atl1c_hw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/atl1c/atl1c_hw.c +1 -1
index d8501f0..919080b 100644
@@ -480,7 +480,7 @@ int atl1c_phy_reset(struct atl1c_hw *hw)
 		atl1c_write_phy_reg(hw, MII_DBG_DATA, 0x929D);
 	}
 	if (hw->nic_type = athr_l1c || hw->nic_type = athr_l2c_b2
-		|| hw->nic_type = athr_l2c || hw->nic_type = athr_l2c) {
+		|| hw->nic_type = athr_l2c) {
 		atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x29);
 		atl1c_write_phy_reg(hw, MII_DBG_DATA, 0xB6DD);
 	}
#17 lore raw

PATCH 4/7 arch/x86/mm/kmemcheck: Remove double test

In reply to Julia Lawall

The opcodes 0x2e and 0x3e are tested for in the first Group 2 line as well.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

  || ... || E
|

* E
&& ... && E
)
// </smpl>

---
This is a guess as to what the code should be. Perhaps something else should have been tested instead.

 arch/x86/mm/kmemcheck/opcode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/kmemcheck/opcode.c +1 -1
index 63c19e2..324aa3f 100644
@@ -9,7 +9,7 @@ static bool opcode_is_prefix(uint8_t b)
 		b = 0xf0 || b = 0xf2 || b = 0xf3
 		/* Group 2 */
 		|| b = 0x2e || b = 0x36 || b = 0x3e || b = 0x26
-		|| b = 0x64 || b = 0x65 || b = 0x2e || b = 0x3e
+		|| b = 0x64 || b = 0x65
 		/* Group 3 */
 		|| b = 0x66
 		/* Group 4 */
#22 lore raw

PATCH 5/7 drivers/regulator: Remove double test

In reply to Julia Lawall

The current code tests the gpio_vid0 field twice. Test the gpio_vid1 fields in place of the second gpio_vid0 test.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

  || ... || E
|

* E
&& ... && E
)
// </smpl>

---
This is a guess as to what the code should be.

 drivers/regulator/max8952.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/max8952.c +1 -1
index f2af0b1..7bf63f4 100644
@@ -139,7 +139,7 @@ static int max8952_set_voltage(struct regulator_dev *rdev,
 	u8 vid = -1, i;
 
 	if (!gpio_is_valid(max8952->pdata->gpio_vid0) ||
-			!gpio_is_valid(max8952->pdata->gpio_vid0)) {
+			!gpio_is_valid(max8952->pdata->gpio_vid1)) {
 		/* DVS not supported */
 		return -EPERM;
 	}
#24 lore raw

PATCH 6/7 drivers/media/dvb/siano: Remove double test

In reply to Julia Lawall

The same expression is tested twice and the result is the same each time.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

  || ... || E
|

* E
&& ... && E
)
// </smpl>

---
 drivers/media/dvb/siano/smscoreapi.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/dvb/siano/smscoreapi.c +1 -2
index d93468c..70e3e0c 100644
@@ -1511,8 +1511,7 @@ int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 PinNum,
 		u32 msgData[3]; /* keep it 3 ! */
 	} *pMsg;
 
-	if ((NewLevel > 1) || (PinNum > MAX_GPIO_PIN_NUMBER) ||
-			(PinNum > MAX_GPIO_PIN_NUMBER))
+	if ((NewLevel > 1) || (PinNum > MAX_GPIO_PIN_NUMBER))
 		return -EINVAL;
 
 	totalLen = sizeof(struct SmsMsgHdr_ST) +
#25 lore raw

PATCH 7/7 net/wireless: Remove double test

In reply to Julia Lawall

The same expression is tested twice and the result is the same each time.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

  || ... || E
|

* E
&& ... && E
)
// </smpl>

---
 net/wireless/wext-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/wext-core.c +1 -1
index 0ef17bc..4038593 100644
@@ -611,7 +611,7 @@ struct iw_statistics *get_wireless_stats(struct net_device *dev)
 #endif
 
 #ifdef CONFIG_CFG80211_WEXT
-	if (dev->ieee80211_ptr && dev->ieee80211_ptr &&
+	if (dev->ieee80211_ptr &&
 	    dev->ieee80211_ptr->wiphy &&
 	    dev->ieee80211_ptr->wiphy->wext &&
 	    dev->ieee80211_ptr->wiphy->wext->get_wireless_stats)
#3 lore raw

Re: [PATCH 2/7] drivers/usb/gadget: Remove double test

In reply to Julia Lawall

Please update $SUBJECT to say which driver is
affected; it's not everything in that directory,
and accurate GIT summaries help a lot.

#9 lore raw

Re: [PATCH 2/7] drivers/usb/gadget: Remove double test

In reply to Julia Lawall
Quoted 11 lines · Julia Lawall

This is a guess as to what the code should be. Perhaps something else should have been tested instead.

 drivers/usb/gadget/amd5536udc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/amd5536udc.c +0 -0
index 731150d..6c40c99 100644

drivers/usb/gadget/amd5536udc.c static void print_regs(struct udc *dev) · line 206

Quoted 5 lines
drivers/usb/gadget/amd5536udc.c +1 -1
@@ -203,7 +203,7 @@ static void print_regs(struct udc *dev)
 		DBG(dev, "DMA mode       = PPBNDU (packet per buffer "
 			"WITHOUT desc. update)\n");
 		dev_info(&dev->pdev->dev, "DMA mode (%s)\n", "PPBNDU");
-	} else if (use_dma && use_dma_ppb_du && use_dma_ppb_du) {
+	} else if (use_dma && use_dma_ppb_du) {

My guess is that "use_dma_ppb" was intended.

regards,
dan carpenter

#10 lore raw

Re: [PATCH 2/7] drivers/usb/gadget/amd5536udc.c: Remove double test

The same expression is tested twice and the result is the same each time. Instead test for use_dma_ppb as in the test above.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

  || ... || E
|

* E
&& ... && E
)
// </smpl>

---
 drivers/usb/gadget/amd5536udc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/amd5536udc.c +1 -1
index 731150d..6c40c99 100644
@@ -203,7 +203,7 @@ static void print_regs(struct udc *dev)
 		DBG(dev, "DMA mode       = PPBNDU (packet per buffer "
 			"WITHOUT desc. update)\n");
 		dev_info(&dev->pdev->dev, "DMA mode (%s)\n", "PPBNDU");
-	} else if (use_dma && use_dma_ppb_du && use_dma_ppb_du) {
+	} else if (use_dma && use_dma_ppb && use_dma_ppb_du) {
 		DBG(dev, "DMA mode       = PPBDU (packet per buffer "
 			"WITH desc. update)\n");
 		dev_info(&dev->pdev->dev, "DMA mode (%s)\n", "PPBDU");
#13 lore raw

Re: [PATCH 2/7] drivers/usb/gadget: Remove double test

In reply to Dan Carpenter
Quoted 7 lines · Dan Carpenter
Quoted 6 lines · Julia Lawall

This is a guess as to what the code should be. Perhaps something else should have been tested instead.

 drivers/usb/gadget/amd5536udc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

drivers/usb/gadget/amd5536udc.c static void print_regs(struct udc *dev) · line 206

Quoted 10 lines
drivers/usb/gadget/amd5536udc.c +1 -1
index 731150d..6c40c99 100644
@@ -203,7 +203,7 @@ static void print_regs(struct udc *dev)
 		DBG(dev, "DMA mode       = PPBNDU (packet per buffer "
 			"WITHOUT desc. update)\n");
 		dev_info(&dev->pdev->dev, "DMA mode (%s)\n", "PPBNDU");
-	} else if (use_dma && use_dma_ppb_du && use_dma_ppb_du) {
+	} else if (use_dma && use_dma_ppb_du) {

My guess is that "use_dma_ppb" was intended.

Thanks. I made this change.

julia

#15 lore raw

Re: [PATCH 3/7] drivers/net/atl1c: Remove double test

In reply to Julia Lawall

I added the Atheros people to the CC list. Jie Yang should know.

regards,
dan carpenter

Quoted 46 lines · Julia Lawall

The nic_type field is compared to athr_l2c twice.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

  || ... || E
|

* E
&& ... && E
)
// </smpl>

---
This is a guess as to what the code should be. Perhaps something else should have been tested instead.

 drivers/net/atl1c/atl1c_hw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/atl1c/atl1c_hw.c +1 -2
index d8501f0..919080b 100644
@@ -480,7 +480,7 @@ int atl1c_phy_reset(struct atl1c_hw *hw)
 		atl1c_write_phy_reg(hw, MII_DBG_DATA, 0x929D);
 	}
 	if (hw->nic_type = athr_l1c || hw->nic_type = athr_l2c_b2
-		|| hw->nic_type = athr_l2c || hw->nic_type = athr_l2c) {
+		|| hw->nic_type = athr_l2c) {
 		atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x29);
 		atl1c_write_phy_reg(hw, MII_DBG_DATA, 0xB6DD);
 	}
 
--

To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH 2/7] drivers/usb/gadget: Remove double test

In reply to David Brownell
Quoted 2 lines · David Brownell

Please update $SUBJECT to say which driver is
affected;

Done.

Quoted 2 lines

it's not everything in that directory,
and accurate GIT summaries help a lot.

Is there some sort of rule that can be followed? For example, if the patch affects only one, file, should that file be named? What if the patch affects only two files?

thanks,
julia

#5 lore raw

Re: [PATCH 2/7] drivers/usb/gadget: Remove double test

Quoted 5 lines · Julia Lawall
Quoted 2 lines · David Brownell

Please update $SUBJECT to say which driver is
affected;

Quoted 8 lines

Done.

Quoted 2 lines

it's not everything in that directory,
and accurate GIT summaries help a lot.

Is there some sort of rule that can be followed? For example, if the patch affects only one, file, should that file be named? What if the patch affects only two files?

gitk $path or git shortlog $path, with $path being the file or directory, give a quick impression how the resident developers call their driver or subsystem updates. E.g. ^USB: instead of ^drivers/usb/.

However, the committer could still adjust the title, so no drama if the patch subject as written by a cross-tree developer looks different from those of the usual subsystem patches. IMO this is one of the tasks of a subsystem maintainer. And it is quickly enough done with a git commit --amend.

There is only a drawbackif the subject is too broad /and/ if the Cc list is too short; a driver developer may miss to see the submission. The danger of that is low though when get_maintainer.pl is used to good effect.

Signature · 3 lines
Stefan Richter
-===-=-=- =--- ==--
http://arcgraph.de/sr/
#6 lore raw

Re: [PATCH 2/7] drivers/usb/gadget: Remove double test

Quoted 19 lines · Stefan Richter
Quoted 5 lines · Julia Lawall
Quoted 2 lines · David Brownell

Please update $SUBJECT to say which driver is
affected;

Quoted 8 lines

Done.

Quoted 2 lines

it's not everything in that directory,
and accurate GIT summaries help a lot.

Is there some sort of rule that can be followed? For example, if the patch affects only one, file, should that file be named? What if the patch affects only two files?

gitk $path or git shortlog $path, with $path being the file or directory, give a quick impression how the resident developers call their driver or subsystem updates. E.g. ^USB: instead of ^drivers/usb/.

Quoted 8 lines

However, the committer could still adjust the title, so no drama if the patch subject as written by a cross-tree developer looks different from those of the usual subsystem patches. IMO this is one of the tasks of a subsystem maintainer. And it is quickly enough done with a git commit --amend.

There is only a drawbackif the subject is too broad /and/ if the Cc list is too short; a driver developer may miss to see the submission. The danger of that is low though when get_maintainer.pl is used to good effect.

OK, thanks.

julia

#7 lore raw

Re: [PATCH 2/7] drivers/usb/gadget: Remove double test

Quoted 8 lines · Julia Lawall

From: Julia Lawall <[email protected]>
Subject: Re: [PATCH 2/7] drivers/usb/gadget: Remove double test
To: "Stefan Richter" <[email protected]>
Cc: "David Brownell" <[email protected]>, "Thomas Dahlmann" <[email protected]>, [email protected], "David Brownell" <[email protected]>, "Greg Kroah-Hartman" <[email protected]>, [email protected], [email protected], [email protected]
Date: Saturday, August 28, 2010, 10:17 AM
On Sat, 28 Aug 2010, Stefan Richter
wrote:

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines · Julia Lawall
Quoted 1 line · David Brownell

Please update $SUBJECT to say which driver

is

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

affected;

Done.

Thanks. Unless the author/maintainer of this driver objects, the patch is OK by me.

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

it's not everything in that directory,
and accurate GIT summaries help a lot.

Is there some sort of rule that can be

followed?

Don't be misleading ...

Generally, if it updates just one driver, mention that driver in $SUBJECT.

Only say the subsystem itself is being updated (which your original $SUBJECT did) when the patch affects framework code, that's shared by all drivers,

 > > > What if the

Quoted 1 line
Quoted 1 line
Quoted 1 line

patch affects only two files?

Which two files?
The "patch updates one thing" rule will then cause it to affect only one driver (usually) or some framework issue, so the above policies kick in directly.

Rarely there will be bugs repeated (e.g. via cut/paste) in multiple drivers, ... in which
case it can make sense to summarize a patch
as a multi-driver subsystem fix . Similarly with API changes.

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

Re: [PATCH 2/7] drivers/usb/gadget: Remove double test

In reply to Stefan Richter
Quoted 3 lines · Stefan Richter

There is only a drawback if the subject
is too broad /and/ > if the Cc list is
too short;

Not entirely true. Recall that one of the roles
of the patch summary is serving as a search key
for Google or whatever ... changing it decouples patches from their discussion, complicating later troubleshooting (probably not in this
case, but for some patches, very much so).

- Dave

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

Re: [PATCH 2/7] drivers/usb/gadget/amd5536udc.c: Remove double test

In reply to Julia Lawall
Quoted 19 lines · Julia Lawall

From: Julia Lawall <[email protected]>
Subject: Re: [PATCH 2/7] drivers/usb/gadget/amd5536udc.c: Remove double test
To: "Dan Carpenter" <[email protected]>
Cc: "Thomas Dahlmann" <[email protected]>, [email protected], "David Brownell" <[email protected]>, "Greg Kroah-Hartman" <[email protected]>, [email protected], [email protected], [email protected]
Date: Saturday, August 28, 2010, 9:48 AM
The same expression is tested twice
and the result is the same each time.
Instead test for use_dma_ppb as in the test above.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

Quoted 8 lines
  || ... || E
|

* E
  && ... && E
)
// </smpl>

OK by me unless the maintainer/author objects.

Thank you!

- Dave

Quoted 24 lines
---
 drivers/usb/gadget/amd5536udc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/amd5536udc.c +0 -0
index 731150d..6c40c99 100644
@@ -203,7 +203,7 @@ static void print_regs(struct udc
 *dev)
         DBG(dev, "DMA

mode       = PPBNDU (packet per
buffer "

"WITHOUT desc. update)\n");

dev_info(&dev->pdev->dev, "DMA mode (%s)\n",
"PPBNDU");
-    } else if (use_dma &&
use_dma_ppb_du && use_dma_ppb_du) {
+    } else if (use_dma &&
use_dma_ppb && use_dma_ppb_du) {

Quoted 10 lines

        DBG(dev, "DMA
mode       = PPBDU (packet per
buffer "

"WITH desc. update)\n");

dev_info(&dev->pdev->dev, "DMA mode (%s)\n",
"PPBDU");

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw

Re: [PATCH 3/7] drivers/net/atl1c: Remove double test

In reply to Dan Carpenter
Quoted 34 lines · Dan Carpenter

I added the Atheros people to the CC list. Jie Yang should know.

regards,
dan carpenter

Quoted 28 lines · Julia Lawall

The nic_type field is compared to athr_l2c twice.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

  || ... || E
|

* E
&& ... && E
)
// </smpl>

---
This is a guess as to what the code should be. Perhaps something else should have been tested instead.

 drivers/net/atl1c/atl1c_hw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

drivers/net/atl1c/atl1c_hw.c int atl1c_phy_reset(struct atl1c_hw *hw) · line 486

Quoted 13 lines
drivers/net/atl1c/atl1c_hw.c +1 -1
index d8501f0..919080b 100644
@@ -480,7 +480,7 @@ int atl1c_phy_reset(struct atl1c_hw *hw)
 		atl1c_write_phy_reg(hw, MII_DBG_DATA, 0x929D);
 	}
 	if (hw->nic_type = athr_l1c || hw->nic_type = athr_l2c_b2
-		|| hw->nic_type = athr_l2c || hw->nic_type = athr_l2c) {
+		|| hw->nic_type = athr_l2c) {
 		atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x29);
 		atl1c_write_phy_reg(hw, MII_DBG_DATA, 0xB6DD);
 	}

The patch is pretty obvious. Looks good.

Luis

Reviewed-by on v1 4/7
#18 lore raw

Re: [PATCH 4/7] arch/x86/mm/kmemcheck: Remove double test

In reply to Julia Lawall
Quoted 19 lines · Julia Lawall

The opcodes 0x2e and 0x3e are tested for in the first Group 2 line as well.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

//<smpl>
@expression@
expression E;
@@

(
* E

   || ... || E
|

* E
&& ...&& E
)
//</smpl>

Quoted 5 lines

---
This is a guess as to what the code should be. Perhaps something else should have been tested instead.

The last two items are branch hint prefixes that use same encoding as CS and DS segment override prefixes.

Can you pick this up in the x86.git tree, please?

Quoted 17 lines
  arch/x86/mm/kmemcheck/opcode.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/kmemcheck/opcode.c +1 -1
index 63c19e2..324aa3f 100644
@@ -9,7 +9,7 @@ static bool opcode_is_prefix(uint8_t b)
  		b = 0xf0 || b = 0xf2 || b = 0xf3
  		/* Group 2 */
  		|| b = 0x2e || b = 0x36 || b = 0x3e || b = 0x26
-		|| b = 0x64 || b = 0x65 || b = 0x2e || b = 0x3e
+		|| b = 0x64 || b = 0x65
  		/* Group 3 */
  		|| b = 0x66
  		/* Group 4 */
#19 lore raw

[tip:x86/mm] x86, kmemcheck: Remove double test

In reply to Julia Lawall
Commit-ID:  9fbaf49c7f717740002d49eee1bbd03d89d8766a
Gitweb:     http://git.kernel.org/tip/9fbaf49c7f717740002d49eee1bbd03d89d8766a
Author:     Julia Lawall <[email protected]>
AuthorDate: Sat, 28 Aug 2010 17:41:03 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 30 Aug 2010 09:19:28 +0200

x86, kmemcheck: Remove double test

The opcodes 0x2e and 0x3e are tested for in the first Group 2 line as well.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

  || ... || E
|

* E
&& ... && E
)
// </smpl>

LKML-Reference: <[email protected]>

---
 arch/x86/mm/kmemcheck/opcode.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/mm/kmemcheck/opcode.c +1 -1
index 63c19e2..324aa3f 100644
@@ -9,7 +9,7 @@ static bool opcode_is_prefix(uint8_t b)
 		b == 0xf0 || b == 0xf2 || b == 0xf3
 		/* Group 2 */
 		|| b == 0x2e || b == 0x36 || b == 0x3e || b == 0x26
-		|| b == 0x64 || b == 0x65 || b == 0x2e || b == 0x3e
+		|| b == 0x64 || b == 0x65
 		/* Group 3 */
 		|| b == 0x66
 		/* Group 4 */
#12 lore raw

Re: [PATCH 2/7] drivers/usb/gadget/amd5536udc.c: Remove double test

In reply to David Brownell
Quoted 33 lines · David Brownell
Quoted 19 lines · Julia Lawall

From: Julia Lawall <[email protected]>
Subject: Re: [PATCH 2/7] drivers/usb/gadget/amd5536udc.c: Remove double test
To: "Dan Carpenter" <[email protected]>
Cc: "Thomas Dahlmann" <[email protected]>, [email protected], "David Brownell" <[email protected]>, "Greg Kroah-Hartman" <[email protected]>, [email protected], [email protected], [email protected]
Date: Saturday, August 28, 2010, 9:48 AM
The same expression is tested twice
and the result is the same each time.
Instead test for use_dma_ppb as in the test above.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

Quoted 9 lines
  || ... || E
|

* E
&& ... && E
)
// </smpl>

Quoted 7 lines

OK by me unless the maintainer/author objects.

Thank you!

- Dave

This fix is OK. Thank you for figuring this out!

- Thomas

Quoted 38 lines
Quoted 36 lines
  
---
 drivers/usb/gadget/amd5536udc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/amd5536udc.c +0 -0
index 731150d..6c40c99 100644
@@ -203,7 +203,7 @@ static void print_regs(struct udc
 *dev)
         DBG(dev, "DMA

mode = PPBNDU (packet per
buffer "

"WITHOUT desc. update)\n");

dev_info(&dev->pdev->dev, "DMA mode (%s)\n",
"PPBNDU");
- } else if (use_dma &&
use_dma_ppb_du && use_dma_ppb_du) {
+ } else if (use_dma &&
use_dma_ppb && use_dma_ppb_du) {
DBG(dev, "DMA
mode = PPBDU (packet per
buffer "

"WITH desc. update)\n");

dev_info(&dev->pdev->dev, "DMA mode (%s)\n",
"PPBDU");

#20 lore raw

Re: [tip:x86/mm] x86, kmemcheck: Remove double test

In reply to tip-bot for Julia Lawall
Quoted 29 lines · tip-bot for Julia Lawall

Commit-ID:  9fbaf49c7f717740002d49eee1bbd03d89d8766a
Gitweb:     http://git.kernel.org/tip/9fbaf49c7f717740002d49eee1bbd03d89d8766a
Author:     Julia Lawall <[email protected]>
AuthorDate: Sat, 28 Aug 2010 17:41:03 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 30 Aug 2010 09:19:28 +0200

x86, kmemcheck: Remove double test

The opcodes 0x2e and 0x3e are tested for in the first Group 2 line as well.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

 || ... || E
|

* E
 && ... && E
)
// </smpl>

Quoted 9 lines

LKML-Reference: <[email protected]>

---
 arch/x86/mm/kmemcheck/opcode.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)

Sorry, was a bit late.

Thanks for the patch, review, and picking up :-)

Vegard

#21 lore raw

Re: [tip:x86/mm] x86, kmemcheck: Remove double test

Quoted 40 lines · Vegard Nossum
Quoted 29 lines · tip-bot for Julia Lawall

Commit-ID:  9fbaf49c7f717740002d49eee1bbd03d89d8766a
Gitweb:     http://git.kernel.org/tip/9fbaf49c7f717740002d49eee1bbd03d89d8766a
Author:     Julia Lawall <[email protected]>
AuthorDate: Sat, 28 Aug 2010 17:41:03 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 30 Aug 2010 09:19:28 +0200

x86, kmemcheck: Remove double test

The opcodes 0x2e and 0x3e are tested for in the first Group 2 line as well.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E

 || ... || E
|

* E
 && ... && E
)
// </smpl>

Quoted 9 lines

LKML-Reference: <[email protected]>

---
 arch/x86/mm/kmemcheck/opcode.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 3 lines

Sorry, was a bit late.

Thanks for the patch, review, and picking up :-)

You are welcome :)

Ingo