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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Julia Lawall
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
  || ... || E
|
* E
  && ... && E
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

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

diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index 731150d..6c40c99 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -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");

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/7] Remove double test, Julia Lawall, (Sat Aug 28, 8:40 am)
[PATCH 1/7] drivers/staging: Remove double test, Julia Lawall, (Sat Aug 28, 8:41 am)
[PATCH 2/7] drivers/usb/gadget: Remove double test, Julia Lawall, (Sat Aug 28, 8:41 am)
[PATCH 3/7] drivers/net/atl1c: Remove double test, Julia Lawall, (Sat Aug 28, 8:41 am)
[PATCH 4/7] arch/x86/mm/kmemcheck: Remove double test, Julia Lawall, (Sat Aug 28, 8:41 am)
[PATCH 5/7] drivers/regulator: Remove double test, Julia Lawall, (Sat Aug 28, 8:41 am)
[PATCH 6/7] drivers/media/dvb/siano: Remove double test, Julia Lawall, (Sat Aug 28, 8:41 am)
[PATCH 7/7] net/wireless: Remove double test, Julia Lawall, (Sat Aug 28, 8:41 am)
Re: [PATCH 2/7] drivers/usb/gadget: Remove double test, Dan Carpenter, (Sat Aug 28, 9:37 am)
Re: [PATCH 2/7] drivers/usb/gadget/amd5536udc.c: Remove do ..., Julia Lawall, (Sat Aug 28, 9:48 am)
Re: [PATCH 2/7] drivers/usb/gadget: Remove double test, Julia Lawall, (Sat Aug 28, 9:49 am)
Re: [PATCH 3/7] drivers/net/atl1c: Remove double test, Dan Carpenter, (Sat Aug 28, 9:50 am)
Re: [PATCH 3/7] drivers/net/atl1c: Remove double test, Luis R. Rodriguez, (Sat Aug 28, 1:10 pm)
[tip:x86/mm] x86, kmemcheck: Remove double test, tip-bot for Julia Lawall, (Mon Aug 30, 1:36 am)
Re: [tip:x86/mm] x86, kmemcheck: Remove double test, Vegard Nossum, (Thu Sep 2, 12:08 pm)
Re: [tip:x86/mm] x86, kmemcheck: Remove double test, Ingo Molnar, (Thu Sep 2, 11:21 pm)