delete double assignment
Subsystems (15)
cover delete double assignment
These patches fix cases where there are two adjacent assignments to the same location. In practice, many such occurrences appear to be intentional, eg to initialize volatile memory, but these cases do not seem to fall into that category.
PATCH 1/14 drivers/staging: delete double assignment
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location. In three of the cases, the two assignments are identical. In the case of the file rt2860/common/cmm_aes.c, the assigned variable i is never used, so both assignments are dropped.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
--- drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c | 1 - drivers/staging/hv/hv_utils.c | 3 --- drivers/staging/rt2860/common/cmm_aes.c | 2 -- drivers/staging/westbridge/astoria/api/src/cyasusb.c | 1 - 4 files changed, 7 deletions(-)
drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c +0 -1
@@ -286,7 +286,6 @@ int ft1000_CreateDevice(struct ft1000_device *dev) pid =kernel_thread (exec_mknod, (void *)info,0 );// initialize application information - info->appcnt =0 ;// if (ft1000_flarion_cnt == 0) { //
drivers/staging/hv/hv_utils.c +0 -3
@@ -212,9 +212,6 @@ static void heartbeat_onchannelcallback(void *context) recvlen, requestid); icmsghdrp = (struct icmsg_hdr *)&buf[ -sizeof (struct vmbuspipe_hdr )]; - - icmsghdrp = (struct icmsg_hdr *)&buf[sizeof (struct vmbuspipe_hdr )];if (icmsghdrp->icmsgtype ==ICMSGTYPE_NEGOTIATE ) {
drivers/staging/rt2860/common/cmm_aes.c +0 -2
@@ -330,8 +330,6 @@ void construct_mic_iv(unsigned char *mic_iv,for (i =8 ; i <14 ; i++) mic_iv[i] = pn_vector[13 - i];/* mic_iv[8:13] = PN[5:0] */ #endif - i = (payload_length /256 ); - i = (payload_length %256 ); mic_iv[14 ] = (unsigned char )(payload_length /256 ); mic_iv[15 ] = (unsigned char )(payload_length %256 );
drivers/staging/westbridge/astoria/api/src/cyasusb.c +0 -1
@@ -1417,7 +1417,6 @@ cy_as_usb_set_enum_config(cy_as_device_handle handle,*/ bus_mask =0 ; media_mask =0 ; - media_mask =0 ;for (bus =0 ; bus <CY_AS_MAX_BUSES ; bus++) {for (device =0 ; device <CY_AS_MAX_STORAGE_DEVICES ; device++) { if (config_p->devices_to_enumerate[bus][device] ==
PATCH 2/14 drivers/usb/gadget/amd5536udc.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
--- drivers/usb/gadget/amd5536udc.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/gadget/amd5536udc.c +0 -1
@@ -3359,7 +3359,6 @@ static int udc_probe(struct udc *dev)dev_set_name (&dev->gadget.dev,"gadget" ); dev->gadget.dev.release = gadget_release; dev->gadget.name = name; - dev->gadget.name = name; dev->gadget.is_dualspeed =1 ;/* init registers, interrupts, ... */
Re: [PATCH 2/14] drivers/usb/gadget/amd5536udc.c: delete double assignment
ACK
Thanks!
Thomas
Quoted 36 lines · Julia Lawall
From: Julia Lawall<[email protected]>
Delete successive assignments to the same location.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)//<smpl>
@@
expression i;
@@*i = ...;
i = ...;
//</smpl>Signed-off-by Julia Lawall<[email protected]>--- drivers/usb/gadget/amd5536udc.c | 1 - 1 file changed, 1 deletion(-)drivers/usb/gadget/amd5536udc.c +0
-1@@ -3359,7 +3359,6 @@ static int udc_probe(struct udc *dev)dev_set_name (&dev->gadget.dev,"gadget" ); dev->gadget.dev.release = gadget_release; dev->gadget.name = name; - dev->gadget.name = name; dev->gadget.is_dualspeed =1 ;/* init registers, interrupts, ... */
PATCH 3/14 drivers/vhost/vhost.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
--- drivers/vhost/vhost.c | 1 - 1 file changed, 1 deletion(-)
drivers/vhost/vhost.c +0 -1
@@ -157,7 +157,6 @@ static void vhost_vq_reset(struct vhost_dev *dev, vq->avail_idx =0 ; vq->last_used_idx =0 ; vq->used_flags =0 ; - vq->used_flags =0 ; vq->log_used = false; vq->log_addr =-1ull ; vq->vhost_hlen =0 ;
Re: [PATCH 3/14] drivers/vhost/vhost.c: delete double assignment
Quoted 12 lines · Julia Lawall
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)// <smpl>
@@
expression i;
@@
Quoted 5 lines
*i = ...;
i = ...;
// </smpl>Signed-off-by Julia Lawall <[email protected]>
Thanks, applied.
Quoted 16 lines
--- drivers/vhost/vhost.c | 1 - 1 file changed, 1 deletion(-)drivers/vhost/vhost.c +0
-1@@ -157,7 +157,6 @@ static void vhost_vq_reset(struct vhost_dev *dev, vq->avail_idx =0 ; vq->last_used_idx =0 ; vq->used_flags =0 ; - vq->used_flags =0 ; vq->log_used = false; vq->log_addr =-1ull ; vq->vhost_hlen =0 ;
PATCH 4/14 drivers/staging/brcm80211/brcmfmac/dhd_linux.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Delete successive assignments to the same location. dhd_ops_virt contains a subset of the definitions of dhd_ops_pri.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
--- drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +0 -2
@@ -2222,8 +2222,6 @@ int dhd_net_attach(dhd_pub_t *dhdp, int ifidx)ASSERT (net);ASSERT (!net->netdev_ops); - net->netdev_ops = &dhd_ops_virt; - net->netdev_ops = &dhd_ops_pri;/*
PATCH 5/14 drivers/net/sb1000.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
The other code around these duplicated assignments initializes the 0 1 2 and 3 elements of an array, so change the initialization of the rx_session_id array to do the same.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
---
This changes the semantics and has not been tested.
drivers/net/sb1000.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/sb1000.c +3 -3
@@ -961,9 +961,9 @@ sb1000_open(struct net_device *dev) lp->rx_error_count =0 ; lp->rx_error_dpc_count =0 ; lp->rx_session_id[0 ] =0x50 ; - lp->rx_session_id[0 ] =0x48 ; - lp->rx_session_id[0 ] =0x44 ; - lp->rx_session_id[0 ] =0x42 ; + lp->rx_session_id[1 ] =0x48 ; + lp->rx_session_id[2 ] =0x44 ; + lp->rx_session_id[3 ] =0x42 ; lp->rx_frame_id[0 ] =0 ; lp->rx_frame_id[1 ] =0 ; lp->rx_frame_id[2 ] =0 ;
Re: [PATCH 5/14] drivers/net/sb1000.c: delete double assignment
Quoted 34 lines · Julia Lawall
From: Julia Lawall <[email protected]>
The other code around these duplicated assignments initializes the 0 1 2 and 3 elements of an array, so change the initialization of the
rx_session_idarray to do the same.A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)// <smpl>
@@
expression i;
@@*i = ...;
i = ...;
// </smpl>Signed-off-by Julia Lawall <[email protected]>---
This changes the semantics and has not been tested.drivers/net/sb1000.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/net/sb1000.c +0
-0@@ -961,9 +961,9 @@ sb1000_open(struct net_device *dev) lp->rx_error_count =0 ; lp->rx_error_dpc_count =0 ;
drivers/net/sb1000.c sb1000_open(struct net_device *dev) · line 969
Quoted 10 lines
drivers/net/sb1000.c +3
-3lp->rx_session_id[0 ] =0x50 ; - lp->rx_session_id[0 ] =0x48 ; - lp->rx_session_id[0 ] =0x44 ; - lp->rx_session_id[0 ] =0x42 ; + lp->rx_session_id[1 ] =0x48 ; + lp->rx_session_id[2 ] =0x44 ; + lp->rx_session_id[3 ] =0x42 ; lp->rx_frame_id[0 ] =0 ; lp->rx_frame_id[1 ] =0 ; lp->rx_frame_id[2 ] =0 ;
/me is surprised that this did not cause more problems. Is it needed at all ?
re,
wh
Re: [PATCH 5/14] drivers/net/sb1000.c: delete double assignment
Quoted 42 lines · walter harms
Quoted 39 lines · Julia Lawall
From: Julia Lawall <[email protected]>
The other code around these duplicated assignments initializes the 0 1 2 and 3 elements of an array, so change the initialization of the
rx_session_idarray to do the same.A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)// <smpl>
@@
expression i;
@@*i = ...;
i = ...;
// </smpl>Signed-off-by Julia Lawall <[email protected]>---
This changes the semantics and has not been tested.drivers/net/sb1000.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/net/sb1000.c +2
-3@@ -961,9 +961,9 @@ sb1000_open(struct net_device *dev) lp->rx_error_count =0 ; lp->rx_error_dpc_count =0 ; lp->rx_session_id[0 ] =0x50 ; - lp->rx_session_id[0 ] =0x48 ; - lp->rx_session_id[0 ] =0x44 ; - lp->rx_session_id[0 ] =0x42 ; + lp->rx_session_id[1 ] =0x48 ; + lp->rx_session_id[2 ] =0x44 ;
Quoted 8 lines
drivers/net/sb1000.c sb1000_open(struct net_device *dev) · line 969
Quoted 5 lines
drivers/net/sb1000.c +1
-0+ lp->rx_session_id[3 ] =0x42 ; lp->rx_frame_id[0 ] =0 ; lp->rx_frame_id[1 ] =0 ; lp->rx_frame_id[2 ] =0 ;/me is surprised that this did not cause more problems. Is it needed at all ?
The field appears to be useful. However, there is an ioctl that also initializes the elements of this field with these values and that is implemented correctly. Perhaps that was sufficient to hide the problem in practice.
julia
Re: [PATCH 5/14] drivers/net/sb1000.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Date: Tue, 26 Oct 2010 12:25:34 +0200
Quoted 8 lines
From: Julia Lawall <[email protected]>
The other code around these duplicated assignments initializes the 0 1 2 and 3 elements of an array, so change the initialization of the
rx_session_idarray to do the same.A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
...
Quoted 1 line
Signed-off-by Julia Lawall <[email protected]>
Applied.
PATCH 6/14 arch/mips/pmc-sierra/yosemite/setup.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
---
This change also makes the variable cpu_clock_freq be not used in the current file. If this is the correct change to plat_time_init, then perhaps the declaration of that variable should be moved elsewhere, or the variable should be deleted completely.
arch/mips/pmc-sierra/yosemite/setup.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/mips/pmc-sierra/yosemite/setup.c +1 -2
@@ -140,8 +140,7 @@ int rtc_mips_set_time(unsigned long tim)void __init plat_time_init (void ) { - mips_hpt_frequency = cpu_clock_freq /2 ; -mips_hpt_frequency =33000000 *3 *5 ; + mips_hpt_frequency =33000000 *3 *5 ; }unsigned long ocd_base;
Re: [PATCH 6/14] arch/mips/pmc-sierra/yosemite/setup.c: delete double assignment
Quoted 3 lines · Julia Lawall
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
[...]
Quoted 4 lines
This change also makes the variable
cpu_clock_freqbe not used in the current file. If this is the correct change toplat_time_init, then perhaps the declaration of that variable should be moved elsewhere, or the variable should be deleted completely.
The 2nd assignment is a temporary override for debugging purpose that is it's there intionsionally.
Thanks!
Ralf
Re: [PATCH 6/14] arch/mips/pmc-sierra/yosemite/setup.c: delete double assignment
Quoted 7 lines · Ralf Baechle
Quoted 3 lines · Julia Lawall
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
[...]
Quoted 7 lines
Quoted 4 lines
This change also makes the variable
cpu_clock_freqbe not used in the current file. If this is the correct change toplat_time_init, then perhaps the declaration of that variable should be moved elsewhere, or the variable should be deleted completely.The 2nd assignment is a temporary override for debugging purpose that is it's there intionsionally.
OK, thanks. I indeed suspected that, but I thought it might be worthwhile to mention it, in case it had outlived its usefulness.
julia
PATCH 7/14 drivers/net/typhoon.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Delete successive assignments to the same location. The current definition does not initialize the respRing structure, which has the same type as the cmdRing structure, so initialize that one instead.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
---
This changes the semantics and has not been tested.
drivers/net/typhoon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/typhoon.c +1 -1
@@ -1328,7 +1328,7 @@ typhoon_init_rings(struct typhoon *tp) tp->rxHiRing.lastWrite =0 ; tp->rxBuffRing.lastWrite =0 ; tp->cmdRing.lastWrite =0 ; - tp->cmdRing.lastWrite =0 ; + tp->respRing.lastWrite =0 ; tp->txLoRing.lastRead =0 ; tp->txHiRing.lastRead =0 ;
Re: [PATCH 7/14] drivers/net/typhoon.c: delete double assignment
Quoted 7 lines · Julia Lawall
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location. The current definition does not initialize the respRing structure, which has the same type as the cmdRing structure, so initialize that one instead.
Signed-off-by Julia Lawall <[email protected]>
Quoted 2 lines
---
This changes the semantics and has not been tested.
tp->respRing.lastWrite is only an artifact of using a common struct for the rings and is not otherwise used, so no change to semantics.
Re: [PATCH 7/14] drivers/net/typhoon.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Date: Tue, 26 Oct 2010 12:25:36 +0200
Quoted 8 lines
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location. The current definition does not initialize the respRing structure, which has the same type as the cmdRing structure, so initialize that one instead.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
...
Quoted 1 line
Signed-off-by Julia Lawall <[email protected]>
Applied.
PATCH 8/14 drivers/platform/x86/thinkpad_acpi.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
--- drivers/platform/x86/thinkpad_acpi.c | 1 - 1 file changed, 1 deletion(-)
drivers/platform/x86/thinkpad_acpi.c +0 -1
@@ -8497,7 +8497,6 @@ static void ibm_exit(struct ibm_struct *ibm) ibm->acpi->type, dispatch_acpi_notify); ibm->flags.acpi_notify_installed =0 ; - ibm->flags.acpi_notify_installed =0 ; }if (ibm->flags.proc_created) {
Re: [PATCH 8/14] drivers/platform/x86/thinkpad_acpi.c: delete double assignment
Quoted 3 lines · Julia Lawall
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
There are often results of mismerges or other assorted screw ups, often done by the maintainer itself (e.g. me in thinkpad-acpi's case) during development.
The patch is correct, and I thank you for the head's up. But let me track down what caused it first, hmm? I also highly recommend that this should be done in all cases you find, instead of just blindly fixing the assignment. I suggest using git --blame to track down what added the duplicated assignments, and check if it looks sane...
It is often a VERY BAD IDEA to remove such markers of potential brokennes without checking out if they're actually helpfully trying to warn you of worse badness :p
But hey, maybe you've already done that. If you did, I apologise for preaching to the choir.
Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh
Henrique de Moraes Holschuh
Acked-byRe: [ibm-acpi-devel] [PATCH 8/14] drivers/platform/x86/thinkpad_acpi.c: delete double assignment
Quoted 8 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Julia Lawall
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
There are often results of mismerges or other assorted screw ups, often done by the maintainer itself (e.g. me in thinkpad-acpi's case) during development.
Which was the case, and the error was just a duplicate line indeed and not anything more damaging in one of my commits done a few years ago.
So,
Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh
Re: [PATCH 8/14] drivers/platform/x86/thinkpad_acpi.c: delete double assignment
In reply to Henrique de Moraes HolschuhQuoted 5 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Julia Lawall
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
Quoted 8 lines
There are often results of mismerges or other assorted screw ups, often done by the maintainer itself (e.g. me in thinkpad-acpi's case) during development.
The patch is correct, and I thank you for the head's up. But let me track down what caused it first, hmm? I also highly recommend that this should be done in all cases you find, instead of just blindly fixing the assignment.
I've reviewed the entire patchset per your suggestion and Julia obviously didn't do it blindly. It all looks good. The patcheset fixes a number of bugs.
regards,
dan carpenter
Re: [PATCH 8/14] drivers/platform/x86/thinkpad_acpi.c: delete double assignment
Quoted 10 lines · Dan Carpenter
Quoted 9 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Julia Lawall
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
There are often results of mismerges or other assorted screw ups, often done by the maintainer itself (e.g. me in thinkpad-acpi's case) during development.
Quoted 8 lines
Quoted 4 lines
The patch is correct, and I thank you for the head's up. But let me track down what caused it first, hmm? I also highly recommend that this should be done in all cases you find, instead of just blindly fixing the assignment.
I've reviewed the entire patchset per your suggestion and Julia obviously didn't do it blindly. It all looks good. The patcheset fixes a number of bugs.
Thank you, Dan and Julia.
Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh
Re: [PATCH 8/14] drivers/platform/x86/thinkpad_acpi.c: delete double assignment
In reply to Henrique de Moraes HolschuhQuoted 15 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Julia Lawall
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
There are often results of mismerges or other assorted screw ups, often done by the maintainer itself (e.g. me in thinkpad-acpi's case) during development.
The patch is correct, and I thank you for the head's up. But let me track down what caused it first, hmm? I also highly recommend that this should be done in all cases you find, instead of just blindly fixing the assignment. I suggest using git --blame to track down what added the duplicated assignments, and check if it looks sane...
Quoted 6 lines
It is often a VERY BAD IDEA to remove such markers of potential brokennes without checking out if they're actually helpfully trying to warn you of worse badness :p
But hey, maybe you've already done that. If you did, I apologise for preaching to the choir.
I didn't look for the original source of the problem, except in the case of [PATCH 6/14] arch/mips/pmc-sierra/yosemite/setup.c where I found it already in the pre-git era. Thanks fo rthe suggestion. On the other hand, I was very selective about which code I changed. In particular I left a number of cases like:
x = NULL; // or 0 etc
x = foo(...); // ie a NULL returning function
I figured that this isn't hurting anything, and perhaps it is informative about what kind of value foo might return.
julia
Re: [PATCH 8/14] drivers/platform/x86/thinkpad_acpi.c: delete double assignment
In reply to Henrique de Moraes HolschuhQuoted 15 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Julia Lawall
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
There are often results of mismerges or other assorted screw ups, often done by the maintainer itself (e.g. me in thinkpad-acpi's case) during development.
The patch is correct, and I thank you for the head's up. But let me track down what caused it first, hmm? I also highly recommend that this should be done in all cases you find, instead of just blindly fixing the assignment. I suggest using git --blame to track down what added the duplicated assignments, and check if it looks sane...
Quoted 7 lines
It is often a VERY BAD IDEA to remove such markers of potential brokennes without checking out if they're actually helpfully trying to warn you of worse badness :p
But hey, maybe you've already done that. If you did, I apologise for preaching to the choir.
IMHO that goes beyond what to expect from a kernel janitor. They try to identify minor problems like double inits; why they occur is part of the "maintainer job". The people (should) have much better understand of the code and can identify omissions in there work flow much more easy. To be fair some problems are hard to identify/fix but you can not move that to the janitor.
just my 2 cents,
wh
Re: [PATCH 8/14] drivers/platform/x86/thinkpad_acpi.c: delete double assignment
Quoted 2 lines · walter harms
IMHO that goes beyond what to expect from a kernel janitor.
No way! Of course, we don't mindlessly remove the second assign without trying to figure out if maybe something else was intended. Frankly, I was a little offended by idea that we'd do that.
Of course, we do make mistakes, but they're _honest_ mistakes.
regards,
dan carpenter
Matthew Garrett
AppliedRe: [PATCH 8/14] drivers/platform/x86/thinkpad_acpi.c: delete double assignment
In reply to Julia LawallApplied, thanks.
Signature · 1 line
Matthew Garrett | [email protected]
PATCH 9/14 sound/oss/sb_ess.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
--- sound/oss/sb_ess.c | 1 - 1 file changed, 1 deletion(-)
sound/oss/sb_ess.c +0 -1
@@ -1722,7 +1722,6 @@ printk (KERN_INFO "FKS: es_rec_set_recmask mask = %x\n", mask); right = (value &0x0000ff00 ) >>8 ; }else {/* Turn it off (3) */ left =0 ; - left =0 ; right =0 ; }sb_common_mixer_set (devc, i +ES_REC_MIXER_RECDIFF , left, right);
Takashi Iwai
AppliedRe: [PATCH 9/14] sound/oss/sb_ess.c: delete double assignment
At Tue, 26 Oct 2010 12:25:38 +0200,
Quoted 13 lines · Julia Lawall
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)// <smpl>
@@
expression i;
@@
Quoted 5 lines
*i = ...;
i = ...;
// </smpl>Signed-off-by Julia Lawall <[email protected]>
Thanks, applied now.
Takashi
Quoted 17 lines
--- sound/oss/sb_ess.c | 1 - 1 file changed, 1 deletion(-)sound/oss/sb_ess.c +0
-1@@ -1722,7 +1722,6 @@ printk (KERN_INFO "FKS: es_rec_set_recmask mask = %x\n", mask); right = (value &0x0000ff00 ) >>8 ; }else {/* Turn it off (3) */ left =0 ; - left =0 ; right =0 ; }sb_common_mixer_set (devc, i +ES_REC_MIXER_RECDIFF , left, right);
PATCH 10/14 drivers/isdn: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Delete successive assignments to the same location. In the first case, the hscx array has two elements, so change the assignment to initialize the second one. In the second case, the two assignments are simply identical.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
---
In the first case, the patch changes the semantics and has not been tested.
drivers/isdn/hardware/mISDN/mISDNinfineon.c | 2 +- drivers/isdn/hisax/l3_1tr6.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/isdn/hardware/mISDN/mISDNinfineon.c +1 -1
@@ -563,7 +563,7 @@ reset_inf(struct inf_hw *hw)mdelay (10 ); hw->ipac.isac.adf2 =0x87 ; hw->ipac.hscx[0 ].slot =0x1f ; - hw->ipac.hscx[0 ].slot =0x23 ; + hw->ipac.hscx[1 ].slot =0x23 ;break ;case INF_GAZEL_R753 : val =inl ((u32 )hw->cfg.start +GAZEL_CNTRL );
drivers/isdn/hisax/l3_1tr6.c +0 -2
@@ -164,8 +164,6 @@ l3_1tr6_setup(struct l3_process *pc, u_char pr, void *arg)char tmp[80 ];struct sk_buff *skb = arg; - p = skb->data; -/* Channel Identification */ p = skb->data;if ((p =findie (p, skb->len, WE0_chanID,0 ))) {
Re: [PATCH 10/14] drivers/isdn: delete double assignment
Quoted 46 lines · Julia Lawall
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location. In the first case, the hscx array has two elements, so change the assignment to initialize the second one. In the second case, the two assignments are simply identical.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)// <smpl>
@@
expression i;
@@*i = ...;
i = ...;
// </smpl>Signed-off-by Julia Lawall <[email protected]>---
In the first case, the patch changes the semantics and has not been tested.drivers/isdn/hardware/mISDN/mISDNinfineon.c | 2 +- drivers/isdn/hisax/l3_1tr6.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)drivers/isdn/hardware/mISDN/mISDNinfineon.c +1
-1@@ -563,7 +563,7 @@ reset_inf(struct inf_hw *hw)mdelay (10 ); hw->ipac.isac.adf2 =0x87 ; hw->ipac.hscx[0 ].slot =0x1f ; - hw->ipac.hscx[0 ].slot =0x23 ; + hw->ipac.hscx[1 ].slot =0x23 ;break ;case INF_GAZEL_R753 : val =inl ((u32 )hw->cfg.start +GAZEL_CNTRL );drivers/isdn/hisax/l3_1tr6.c +0
-0
drivers/isdn/hisax/l3_1tr6.c l3_1tr6_setup(struct l3_process *pc, u_char pr, void *arg) · line 169
Quoted 8 lines
drivers/isdn/hisax/l3_1tr6.c +0
-2@@ -164,8 +164,6 @@ l3_1tr6_setup(struct l3_process *pc, u_char pr, void *arg)char tmp[80 ];struct sk_buff *skb = arg; - p = skb->data; -/* Channel Identification */ p = skb->data;if ((p =findie (p, skb->len, WE0_chanID,0 ))) {
perhaps you can move the next assignment out of if also ?
p = findie(skb->data, skb->len, WE0_chanID, 0);
if (p) { ....
re,
wh
Quoted 6 lines
--
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 10/14] drivers/isdn: delete double assignment
Quoted 61 lines · walter harms
Quoted 46 lines · Julia Lawall
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location. In the first case, the hscx array has two elements, so change the assignment to initialize the second one. In the second case, the two assignments are simply identical.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)// <smpl>
@@
expression i;
@@*i = ...;
i = ...;
// </smpl>Signed-off-by Julia Lawall <[email protected]>---
In the first case, the patch changes the semantics and has not been tested.drivers/isdn/hardware/mISDN/mISDNinfineon.c | 2 +- drivers/isdn/hisax/l3_1tr6.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)drivers/isdn/hardware/mISDN/mISDNinfineon.c +1
-1@@ -563,7 +563,7 @@ reset_inf(struct inf_hw *hw)mdelay (10 ); hw->ipac.isac.adf2 =0x87 ; hw->ipac.hscx[0 ].slot =0x1f ; - hw->ipac.hscx[0 ].slot =0x23 ; + hw->ipac.hscx[1 ].slot =0x23 ;break ;case INF_GAZEL_R753 : val =inl ((u32 )hw->cfg.start +GAZEL_CNTRL );drivers/isdn/hisax/l3_1tr6.c +0
-0drivers/isdn/hisax/l3_1tr6.c l3_1tr6_setup(struct l3_process *pc, u_char pr, void *arg) · line 169
Quoted 8 lines
drivers/isdn/hisax/l3_1tr6.c +0
-2@@ -164,8 +164,6 @@ l3_1tr6_setup(struct l3_process *pc, u_char pr, void *arg)char tmp[80 ];struct sk_buff *skb = arg; - p = skb->data; -/* Channel Identification */ p = skb->data;if ((p =findie (p, skb->len, WE0_chanID,0 ))) {perhaps you can move the next assignment out of if also ?
Quoted 2 lines
p =
findie(skb->data, skb->len, WE0_chanID, 0);
if (p) { ....
OK.
julia
Re: [PATCH 10/14] drivers/isdn: delete double assignment
In reply to walter harmsFrom: Julia Lawall <[email protected]>
Delete successive assignments to the same location. In the first case, the hscx array has two elements, so change the assignment to initialize the second one. In the second case, the two assignments are simply identical. Furthermore, neither is necessary, because the effect of the assignment is only visible in the next line, in the assignment in the if test. The patch inlines the right hand side value in the latter assignment and pulls that assignment out of the if test.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
---
In the first case, the patch changes the semantics and has not been tested.
drivers/isdn/hardware/mISDN/mISDNinfineon.c | 2 +- drivers/isdn/hisax/l3_1tr6.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/isdn/hardware/mISDN/mISDNinfineon.c +1 -1
@@ -563,7 +563,7 @@ reset_inf(struct inf_hw *hw)mdelay (10 ); hw->ipac.isac.adf2 =0x87 ; hw->ipac.hscx[0 ].slot =0x1f ; - hw->ipac.hscx[0 ].slot =0x23 ; + hw->ipac.hscx[1 ].slot =0x23 ;break ;case INF_GAZEL_R753 : val =inl ((u32 )hw->cfg.start +GAZEL_CNTRL );
drivers/isdn/hisax/l3_1tr6.c +2 -4
@@ -164,11 +164,9 @@ l3_1tr6_setup(struct l3_process *pc, u_char pr, void *arg)char tmp[80 ];struct sk_buff *skb = arg; - p = skb->data; -/* Channel Identification */ - p = skb->data; -if ((p =findie (p, skb->len, WE0_chanID,0 ))) { + p =findie (skb->data, skb->len, WE0_chanID,0 ); +if (p) {if (p[1 ] !=1 ) {l3_1tr6_error (pc,"setup wrong chanID len" , skb);return ;
Re: [PATCH 10/14] drivers/isdn: delete double assignment
From: Julia Lawall <[email protected]>
Date: Tue, 26 Oct 2010 14:20:56 +0200 (CEST)
Quoted 12 lines
From: Julia Lawall <[email protected]>
Delete successive assignments to the same location. In the first case, the hscx array has two elements, so change the assignment to initialize the second one. In the second case, the two assignments are simply identical. Furthermore, neither is necessary, because the effect of the assignment is only visible in the next line, in the assignment in the if test. The patch inlines the right hand side value in the latter assignment and pulls that assignment out of the if test.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
...
Quoted 1 line
Signed-off-by Julia Lawall <[email protected]>
Applied.
PATCH 11/14 drivers/serial/vr41xx_siu.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
--- drivers/serial/vr41xx_siu.c | 1 - 1 file changed, 1 deletion(-)
drivers/serial/vr41xx_siu.c +0 -1
@@ -849,7 +849,6 @@ void __init vr41xx_siu_early_setup(struct uart_port *port) siu_uart_ports[port->line].type = port->type; siu_uart_ports[port->line].uartclk =SIU_BAUD_BASE *16 ; siu_uart_ports[port->line].mapbase = port->mapbase; - siu_uart_ports[port->line].mapbase = port->mapbase; siu_uart_ports[port->line].ops = &siu_uart_ops; }
PATCH 12/14 drivers/video/omap/blizzard.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Delete successive assignments to the same location. Initialize the out_y field as well as the out_x field, rather than initializing the out_x field twice.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
---
This changes the semantics and has not been tested.
drivers/video/omap/blizzard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/omap/blizzard.c +1 -1
@@ -1590,7 +1590,7 @@ static int blizzard_init(struct omapfb_device *fbdev, int ext_mode, blizzard.auto_update_window.width = fbdev->panel->x_res; blizzard.auto_update_window.height = fbdev->panel->y_res; blizzard.auto_update_window.out_x =0 ; - blizzard.auto_update_window.out_x =0 ; + blizzard.auto_update_window.out_y =0 ; blizzard.auto_update_window.out_width = fbdev->panel->x_res; blizzard.auto_update_window.out_height = fbdev->panel->y_res; blizzard.auto_update_window.format =0 ;
Re: [PATCH 12/14] drivers/video/omap/blizzard.c: delete double assignment
* Julia Lawall <[email protected]>:
Quoted 3 lines
Delete successive assignments to the same location. Initialize the
out_yfield as well as theout_xfield, rather than initializing theout_xfield twice.
Hi there!
An identical patch is already in the -mm tree:
Quoted 14 lines
The patch titled
drivers/video/omap/blizzard.c: suspected typo in assignment
has been added to the -mm tree. Its filename is
video-omap-suspected-typo-in-assignment.patchSee http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject:drivers/video/omap/blizzard.c: suspected typo in assignment
From: Nicolas Kaiser <[email protected]>
Quoted 6 lines
Untested, but looks like an obvious typo to me.
Signed-off-by Nicolas Kaiser <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc Tony Lindgren <[email protected]>Signed-off-by Andrew Morton <[email protected]>
Best regards,
Nicolas Kaiser
PATCH 13/14 drivers/scsi/be2iscsi/be_main.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Delete successive assignments to the same location. Initialize the pwrb_handle field instead of initializing the psgl_handle field twice.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
---
This changes the semantics and has not been tested.
drivers/scsi/be2iscsi/be_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/be2iscsi/be_main.c +1 -1
@@ -3794,7 +3794,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode) task->hdr = (struct iscsi_hdr *)&io_task->cmd_bhs->iscsi_hdr; task->hdr_max =sizeof (struct be_cmd_bhs ); - io_task->psgl_handle =NULL ; + io_task->pwrb_handle =NULL ; io_task->psgl_handle =NULL ;if (task->sc) {
PATCH 14/14 drivers/ata/pata_octeon_cf.c: delete double assignment
In reply to Julia LawallFrom: Julia Lawall <[email protected]>
Delete successive assignments to the same location.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
--- drivers/ata/pata_octeon_cf.c | 2 -- 1 file changed, 2 deletions(-)
drivers/ata/pata_octeon_cf.c +0 -2
@@ -653,8 +653,6 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance) ap = host->ports[i]; ocd = ap->dev->platform_data; - - ocd = ap->dev->platform_data; cf_port = ap->private_data; dma_int.u64 =cvmx_read_csr (CVMX_MIO_BOOT_DMA_INTX (ocd->dma_engine));