Skip to contentSkip to conversation

drivers:staging:gdm72xx Fix increment in a loop

PATCH In review Bogicevic Sasa 2 participants 2 messages Oct 31, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers:staging:gdm72xx Fix increment in a loop

This fixes increment of pos int to be more readable

Lines 	qcb->csr[index].srcport_lo = ((buf[pos++]<<8)&0xff00);
	qcb->csr[index].srcport_lo += buf[pos++];
become
	qcb->csr[index].srcport_lo = get_unaligned_le16(&buf[pos]);
	pos += 2;
---
 drivers/staging/gdm72xx/gdm_qos.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/gdm72xx/gdm_qos.c +8 -8
index 44d04bd..132789c 100644
@@ -406,14 +406,14 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size)
 		qcb->csr[index].ipdst_addr[1] = buf[pos++];
 		qcb->csr[index].ipdst_addr[2] = buf[pos++];
 		qcb->csr[index].ipdst_addr[3] = buf[pos++];
-		qcb->csr[index].srcport_lo = ((buf[pos++] << 8) & 0xff00);
-		qcb->csr[index].srcport_lo += buf[pos++];
-		qcb->csr[index].srcport_hi = ((buf[pos++] << 8) & 0xff00);
-		qcb->csr[index].srcport_hi += buf[pos++];
-		qcb->csr[index].dstport_lo = ((buf[pos++] << 8) & 0xff00);
-		qcb->csr[index].dstport_lo += buf[pos++];
-		qcb->csr[index].dstport_hi = ((buf[pos++] << 8) & 0xff00);
-		qcb->csr[index].dstport_hi += buf[pos++];
+		qcb->csr[index].srcport_lo = get_unaligned_le16(&buf[pos]);
+		pos += 2;
+		qcb->csr[index].srcport_hi = get_unaligned_le16(&buf[pos]);
+		pos += 2;
+		qcb->csr[index].dstport_lo = get_unaligned_le16(&buf[pos]);
+		pos += 2;
+		qcb->csr[index].dstport_hi = get_unaligned_le16(&buf[pos]);
+		pos += 2;
 
 		qcb->qos_limit_size = 254 / qcb->qos_list_cnt;
 		spin_unlock_irqrestore(&qcb->qos_lock, flags);
Signature · 1 line
2.1.4
maintainer
#1 lore raw
Quoted 11 lines · Bogicevic Sasa

This fixes increment of pos int to be more readable

Lines 	qcb->csr[index].srcport_lo = ((buf[pos++]<<8)&0xff00);
	qcb->csr[index].srcport_lo += buf[pos++];
become
	qcb->csr[index].srcport_lo = get_unaligned_le16(&buf[pos]);
	pos += 2;
---
 drivers/staging/gdm72xx/gdm_qos.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

I'm totally confused, please resend all of these patches, numbered in order, so I have a chance to know how to apply them. Also please always
cc: the proper mailing lists for staging patches (hint, not lkml).

thanks,

greg k-h