Skip to contentSkip to conversation

net: irda: delete double assignment

PATCH In review Himangi Saraogi 2 participants 2 messages Jul 28, 2014 – Jul 29, 2014

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

PATCH 1/1 net: irda: delete double assignment

Delete successive assignments to the same location.

A simplified version of Coccinelle semantic match that finds this problem is as follows:

// <smpl>
@@
expression i;
@@

*i = ...;
i = ...;
// </smpl>

---
Should the second assignment have been |=?

 net/irda/irlap_frame.c | 1 -
 1 file changed, 1 deletion(-)
net/irda/irlap_frame.c +0 -1
index 9ea0c93..4c169f6 100644
@@ -621,7 +621,6 @@ void irlap_send_rd_frame(struct irlap_cb *self)
 
 	frame = (struct rd_frame *)skb_put(tx_skb, 2);
 
-	frame->caddr = self->caddr;
 	frame->caddr = RD_RSP | PF_BIT;
 
 	irlap_queue_xmit(self, tx_skb);
Signature · 1 line
1.9.1
maintainer
#1 lore raw

From: Himangi Saraogi <[email protected]>
Date: Mon, 28 Jul 2014 20:58:12 +0530

net/irda/irlap_frame.c void irlap_send_rd_frame(struct irlap_cb *self) · line 625

Quoted 7 lines
net/irda/irlap_frame.c +0 -1
@@ -621,7 +621,6 @@ void irlap_send_rd_frame(struct irlap_cb *self)
 
 	frame = (struct rd_frame *)skb_put(tx_skb, 2);
 
-	frame->caddr = self->caddr;
 	frame->caddr = RD_RSP | PF_BIT;
 

This doesn't look correct to me.

I think both lines should be kept, and the second line should be changed to assign those bits to frame->control.

This is consistent with other parts of the file that make use of the PF_BIT.