[PATCH] drivers:staging:gdm72xx Fix increment in a loop

From: Bogicevic Sasa
Date: Sat Oct 31 2015 - 18:03:18 EST


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;

Signed-off-by: Bogicevic Sasa <brutallesale@xxxxxxxxx>
---
drivers/staging/gdm72xx/gdm_qos.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c
index 44d04bd..132789c 100644
--- a/drivers/staging/gdm72xx/gdm_qos.c
+++ b/drivers/staging/gdm72xx/gdm_qos.c
@@ -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);
--
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/