* [Qemu-devel] [PATCH] Add missing braces
@ 2010-11-11 15:10 Jes.Sorensen
2010-11-16 22:25 ` Anthony Liguori
0 siblings, 1 reply; 2+ messages in thread
From: Jes.Sorensen @ 2010-11-11 15:10 UTC (permalink / raw)
To: qemu-devel; +Cc: blauwirbel
From: Jes Sorensen <Jes.Sorensen@redhat.com>
This patch adds missing braces around if/else statements that call
macros which are likely to result in errors if the macro is
changed. It also makes the code comply better with CODING_STYLE.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
hw/e1000.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/hw/e1000.c b/hw/e1000.c
index 532efdc..724dfbe 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -444,9 +444,10 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
// data descriptor
tp->sum_needed = le32_to_cpu(dp->upper.data) >> 8;
tp->cptse = ( txd_lower & E1000_TXD_CMD_TSE ) ? 1 : 0;
- } else
+ } else {
// legacy descriptor
tp->cptse = 0;
+ }
if (vlan_enabled(s) && is_vlan_txd(txd_lower) &&
(tp->cptse || txd_lower & E1000_TXD_CMD_EOP)) {
@@ -682,8 +683,9 @@ e1000_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
(void *)(buf + vlan_offset), size);
desc.length = cpu_to_le16(size + fcs_len(s));
desc.status |= E1000_RXD_STAT_EOP|E1000_RXD_STAT_IXSM;
- } else // as per intel docs; skip descriptors with null buf addr
+ } else { // as per intel docs; skip descriptors with null buf addr
DBGOUT(RX, "Null RX descriptor!!\n");
+ }
cpu_physical_memory_write(base, (void *)&desc, sizeof(desc));
if (++s->mac_reg[RDH] * sizeof(desc) >= s->mac_reg[RDLEN])
@@ -855,13 +857,14 @@ e1000_mmio_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
#ifdef TARGET_WORDS_BIGENDIAN
val = bswap32(val);
#endif
- if (index < NWRITEOPS && macreg_writeops[index])
+ if (index < NWRITEOPS && macreg_writeops[index]) {
macreg_writeops[index](s, index, val);
- else if (index < NREADOPS && macreg_readops[index])
+ } else if (index < NREADOPS && macreg_readops[index]) {
DBGOUT(MMIO, "e1000_mmio_writel RO %x: 0x%04x\n", index<<2, val);
- else
+ } else {
DBGOUT(UNKNOWN, "MMIO unknown write addr=0x%08x,val=0x%08x\n",
index<<2, val);
+ }
}
static void
--
1.7.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [Qemu-devel] [PATCH] Add missing braces
2010-11-11 15:10 [Qemu-devel] [PATCH] Add missing braces Jes.Sorensen
@ 2010-11-16 22:25 ` Anthony Liguori
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2010-11-16 22:25 UTC (permalink / raw)
To: Jes.Sorensen; +Cc: blauwirbel, qemu-devel
On 11/11/2010 09:10 AM, Jes.Sorensen@redhat.com wrote:
> From: Jes Sorensen<Jes.Sorensen@redhat.com>
>
> This patch adds missing braces around if/else statements that call
> macros which are likely to result in errors if the macro is
> changed. It also makes the code comply better with CODING_STYLE.
>
> Signed-off-by: Jes Sorensen<Jes.Sorensen@redhat.com>
>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
> hw/e1000.c | 13 ++++++++-----
> 1 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/hw/e1000.c b/hw/e1000.c
> index 532efdc..724dfbe 100644
> --- a/hw/e1000.c
> +++ b/hw/e1000.c
> @@ -444,9 +444,10 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
> // data descriptor
> tp->sum_needed = le32_to_cpu(dp->upper.data)>> 8;
> tp->cptse = ( txd_lower& E1000_TXD_CMD_TSE ) ? 1 : 0;
> - } else
> + } else {
> // legacy descriptor
> tp->cptse = 0;
> + }
>
> if (vlan_enabled(s)&& is_vlan_txd(txd_lower)&&
> (tp->cptse || txd_lower& E1000_TXD_CMD_EOP)) {
> @@ -682,8 +683,9 @@ e1000_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
> (void *)(buf + vlan_offset), size);
> desc.length = cpu_to_le16(size + fcs_len(s));
> desc.status |= E1000_RXD_STAT_EOP|E1000_RXD_STAT_IXSM;
> - } else // as per intel docs; skip descriptors with null buf addr
> + } else { // as per intel docs; skip descriptors with null buf addr
> DBGOUT(RX, "Null RX descriptor!!\n");
> + }
> cpu_physical_memory_write(base, (void *)&desc, sizeof(desc));
>
> if (++s->mac_reg[RDH] * sizeof(desc)>= s->mac_reg[RDLEN])
> @@ -855,13 +857,14 @@ e1000_mmio_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
> #ifdef TARGET_WORDS_BIGENDIAN
> val = bswap32(val);
> #endif
> - if (index< NWRITEOPS&& macreg_writeops[index])
> + if (index< NWRITEOPS&& macreg_writeops[index]) {
> macreg_writeops[index](s, index, val);
> - else if (index< NREADOPS&& macreg_readops[index])
> + } else if (index< NREADOPS&& macreg_readops[index]) {
> DBGOUT(MMIO, "e1000_mmio_writel RO %x: 0x%04x\n", index<<2, val);
> - else
> + } else {
> DBGOUT(UNKNOWN, "MMIO unknown write addr=0x%08x,val=0x%08x\n",
> index<<2, val);
> + }
> }
>
> static void
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-16 22:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-11 15:10 [Qemu-devel] [PATCH] Add missing braces Jes.Sorensen
2010-11-16 22:25 ` Anthony Liguori
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.