Remove double test
Subsystems (10)
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.
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
@@ -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
@@ -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
@@ -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;
PATCH 2/7 drivers/usb/gadget: Remove double test
In reply to Julia LawallThe 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
@@ -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" );
PATCH 3/7 drivers/net/atl1c: Remove double test
In reply to Julia LawallThe 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
@@ -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 ); }
PATCH 4/7 arch/x86/mm/kmemcheck: Remove double test
In reply to Julia LawallThe 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
@@ -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 */
PATCH 5/7 drivers/regulator: Remove double test
In reply to Julia LawallThe 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
@@ -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 ; }
PATCH 6/7 drivers/media/dvb/siano: Remove double test
In reply to Julia LawallThe 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
@@ -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) +
PATCH 7/7 net/wireless: Remove double test
In reply to Julia LawallThe 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
@@ -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)
Re: [PATCH 2/7] drivers/usb/gadget: Remove double test
In reply to Julia LawallPlease update $SUBJECT to say which driver is
affected; it's not everything in that directory,
and accurate GIT summaries help a lot.
Re: [PATCH 2/7] drivers/usb/gadget: Remove double test
In reply to Julia LawallQuoted 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
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
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
@@ -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" );
Re: [PATCH 2/7] drivers/usb/gadget: Remove double test
In reply to Dan CarpenterQuoted 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@@ -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
Re: [PATCH 3/7] drivers/net/atl1c: Remove double test
In reply to Julia LawallI added the Atheros people to the CC list. Jie Yang should know.
regards,
dan carpenter
Quoted 46 lines · Julia Lawall
The
nic_typefield is compared toathr_l2ctwice.The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)// <smpl>
@expression@
expression E;
@@(
* E|| ... || E |* E
&& ... && E
)
// </smpl>Signed-off-by Julia Lawall <[email protected]>---
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@@ -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
Re: [PATCH 2/7] drivers/usb/gadget: Remove double test
In reply to David BrownellQuoted 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
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/
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
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
Re: [PATCH 2/7] drivers/usb/gadget: Remove double test
In reply to Stefan RichterQuoted 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
Re: [PATCH 2/7] drivers/usb/gadget/amd5536udc.c: Remove double test
In reply to Julia LawallQuoted 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 foruse_dma_ppbas 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>Signed-off-by Julia Lawall <[email protected]>
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@@ -203,7 +203,7 @@ static void print_regs(struct udc *dev) DBG(dev, "DMAmode = 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
Re: [PATCH 3/7] drivers/net/atl1c: Remove double test
In reply to Dan CarpenterQuoted 34 lines · Dan Carpenter
I added the Atheros people to the CC list. Jie Yang should know.
regards,
dan carpenterQuoted 28 lines · Julia Lawall
The
nic_typefield is compared toathr_l2ctwice.The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)// <smpl>
@expression@
expression E;
@@(
* E|| ... || E |* E
&& ... && E
)
// </smpl>Signed-off-by Julia Lawall <[email protected]>---
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@@ -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
Re: [PATCH 4/7] arch/x86/mm/kmemcheck: Remove double test
In reply to Julia LawallQuoted 19 lines · Julia Lawall
The opcodes
0x2eand0x3eare 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
Signed-off-by Julia Lawall<[email protected]>---
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@@ -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 */
Re: [PATCH 5/7] drivers/regulator: Remove double test
In reply to Julia LawallQuoted 2 lines · Julia Lawall
The current code tests the
gpio_vid0field twice. Test thegpio_vid1fields in place of the secondgpio_vid0test.
[tip:x86/mm] x86, kmemcheck: Remove double test
In reply to Julia LawallCommit-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
@@ -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 */
Re: [PATCH 2/7] drivers/usb/gadget/amd5536udc.c: Remove double test
In reply to David BrownellQuoted 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 foruse_dma_ppbas in the test above.The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)// <smpl>
@expression@
expression E;
@@(
* EQuoted 9 lines
|| ... || E |* E
&& ... && E
)
// </smpl>Signed-off-by Julia Lawall <[email protected]>
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@@ -203,7 +203,7 @@ static void print_regs(struct udc *dev) DBG(dev, "DMAmode = 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");
Re: [tip:x86/mm] x86, kmemcheck: Remove double test
In reply to tip-bot for Julia LawallQuoted 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 +0200x86, kmemcheck: Remove double test
The opcodes
0x2eand0x3eare 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
Signed-off-by Julia Lawall <[email protected]>Reviewed-by Pekka Enberg <[email protected]>Cc Vegard Nossum <[email protected]>LKML-Reference: <[email protected]>
Signed-off-by Ingo Molnar <[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
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 +0200x86, kmemcheck: Remove double test
The opcodes
0x2eand0x3eare 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
Signed-off-by Julia Lawall <[email protected]>Reviewed-by Pekka Enberg <[email protected]>Cc Vegard Nossum <[email protected]>LKML-Reference: <[email protected]>
Signed-off-by Ingo Molnar <[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