Re: [Qemu-devel] [PATCH 2/2] net: pcnet: fix source formatting and indentation

2016-09-30 Thread P J P
+-- On Fri, 30 Sep 2016, Jason Wang wrote --+
| Thanks but there're still several other places that needs to be fixed were 
| reported by robot.
| 
| Please fix them too.

  Done. Sent a revised patch v2.

Thank you.
--
Prasad J Pandit / Red Hat Product Security Team
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F



Re: [Qemu-devel] [PATCH 2/2] net: pcnet: fix source formatting and indentation

2016-09-29 Thread Jason Wang



On 2016年09月30日 02:57, P J P wrote:

From: Prasad J Pandit 

Fix indentations and source format at few places. Add braces
around few 'if' and 'while' statements.

Signed-off-by: Prasad J Pandit 


Thanks but there're still several other places that needs to be fixed 
were reported by robot.


Please fix them too.




[Qemu-devel] [PATCH 2/2] net: pcnet: fix source formatting and indentation

2016-09-29 Thread P J P
From: Prasad J Pandit 

Fix indentations and source format at few places. Add braces
around few 'if' and 'while' statements.

Signed-off-by: Prasad J Pandit 
---
 hw/net/pcnet.c | 122 +
 1 file changed, 63 insertions(+), 59 deletions(-)

diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c
index 3078de8..66d077d 100644
--- a/hw/net/pcnet.c
+++ b/hw/net/pcnet.c
@@ -302,7 +302,7 @@ static inline void pcnet_tmd_load(PCNetState *s, struct 
pcnet_TMD *tmd,
 uint32_t tbadr;
 int16_t length;
 int16_t status;
-   } xda;
+} xda;
 s->phys_mem_read(s->dma_opaque, addr, (void *), sizeof(xda), 0);
 tmd->tbadr = le32_to_cpu(xda.tbadr) & 0xff;
 tmd->length = le16_to_cpu(xda.length);
@@ -664,7 +664,9 @@ static inline int ladr_match(PCNetState *s, const uint8_t 
*buf, int size)
 
 static inline hwaddr pcnet_rdra_addr(PCNetState *s, int idx)
 {
-while (idx < 1) idx += CSR_RCVRL(s);
+while (idx < 1) {
+idx += CSR_RCVRL(s);
+}
 return s->rdra + ((CSR_RCVRL(s) - idx) * (BCR_SWSTYLE(s) ? 16 : 8));
 }
 
@@ -672,8 +674,10 @@ static inline int64_t pcnet_get_next_poll_time(PCNetState 
*s, int64_t current_ti
 {
 int64_t next_time = current_time +
 (65536 - (CSR_SPND(s) ? 0 : CSR_POLL(s))) * 30;
-if (next_time <= current_time)
+
+if (next_time <= current_time) {
 next_time = current_time + 1;
+}
 return next_time;
 }
 
@@ -795,13 +799,13 @@ static void pcnet_init(PCNetState *s)
 mode = le16_to_cpu(initblk.mode);
 rlen = initblk.rlen >> 4;
 tlen = initblk.tlen >> 4;
-   ladrf[0] = le16_to_cpu(initblk.ladrf[0]);
-   ladrf[1] = le16_to_cpu(initblk.ladrf[1]);
-   ladrf[2] = le16_to_cpu(initblk.ladrf[2]);
-   ladrf[3] = le16_to_cpu(initblk.ladrf[3]);
-   padr[0] = le16_to_cpu(initblk.padr[0]);
-   padr[1] = le16_to_cpu(initblk.padr[1]);
-   padr[2] = le16_to_cpu(initblk.padr[2]);
+ladrf[0] = le16_to_cpu(initblk.ladrf[0]);
+ladrf[1] = le16_to_cpu(initblk.ladrf[1]);
+ladrf[2] = le16_to_cpu(initblk.ladrf[2]);
+ladrf[3] = le16_to_cpu(initblk.ladrf[3]);
+padr[0] = le16_to_cpu(initblk.padr[0]);
+padr[1] = le16_to_cpu(initblk.padr[1]);
+padr[2] = le16_to_cpu(initblk.padr[2]);
 rdra = le32_to_cpu(initblk.rdra);
 tdra = le32_to_cpu(initblk.tdra);
 } else {
@@ -809,13 +813,13 @@ static void pcnet_init(PCNetState *s)
 s->phys_mem_read(s->dma_opaque, PHYSADDR(s,CSR_IADR(s)),
 (uint8_t *), sizeof(initblk), 0);
 mode = le16_to_cpu(initblk.mode);
-   ladrf[0] = le16_to_cpu(initblk.ladrf[0]);
-   ladrf[1] = le16_to_cpu(initblk.ladrf[1]);
-   ladrf[2] = le16_to_cpu(initblk.ladrf[2]);
-   ladrf[3] = le16_to_cpu(initblk.ladrf[3]);
-   padr[0] = le16_to_cpu(initblk.padr[0]);
-   padr[1] = le16_to_cpu(initblk.padr[1]);
-   padr[2] = le16_to_cpu(initblk.padr[2]);
+ladrf[0] = le16_to_cpu(initblk.ladrf[0]);
+ladrf[1] = le16_to_cpu(initblk.ladrf[1]);
+ladrf[2] = le16_to_cpu(initblk.ladrf[2]);
+ladrf[3] = le16_to_cpu(initblk.ladrf[3]);
+padr[0] = le16_to_cpu(initblk.padr[0]);
+padr[1] = le16_to_cpu(initblk.padr[1]);
+padr[2] = le16_to_cpu(initblk.padr[2]);
 rdra = le32_to_cpu(initblk.rdra);
 tdra = le32_to_cpu(initblk.tdra);
 rlen = rdra >> 29;
@@ -858,12 +862,12 @@ static void pcnet_start(PCNetState *s)
 printf("pcnet_start\n");
 #endif
 
-if (!CSR_DTX(s))
+if (!CSR_DTX(s)) {
 s->csr[0] |= 0x0010;/* set TXON */
-
-if (!CSR_DRX(s))
+}
+if (!CSR_DRX(s)) {
 s->csr[0] |= 0x0020;/* set RXON */
-
+}
 s->csr[0] &= ~0x0004;   /* clear STOP bit */
 s->csr[0] |= 0x0002;
 pcnet_poll_timer(s);
@@ -925,8 +929,7 @@ static void pcnet_rdte_poll(PCNetState *s)
crda);
 }
 } else {
-printf("pcnet: BAD RMD RDA=0x" TARGET_FMT_plx "\n",
-   crda);
+printf("pcnet: BAD RMD RDA=0x" TARGET_FMT_plx "\n", crda);
 #endif
 }
 }
@@ -1168,10 +1171,11 @@ ssize_t pcnet_receive(NetClientState *nc, const uint8_t 
*buf, size_t size_)
 #endif
 
 while (pktcount--) {
-if (CSR_RCVRC(s) <= 1)
+if (CSR_RCVRC(s) <= 1) {
 CSR_RCVRC(s) = CSR_RCVRL(s);
-else
+} else {
 CSR_RCVRC(s)--;
+}
 }
 
 pcnet_rdte_poll(s);
@@ -1207,7 +1211,7 @@ static void pcnet_transmit(PCNetState *s)
 
 s->tx_busy = 1;
 
-txagain:
+txagain:
 if (pcnet_tdte_poll(s)) {
 struct pcnet_TMD tmd;
 
@@ -1251,7 +1255,7 @@ static void pcnet_transmit(PCNetState *s)