Skip to contentSkip to conversation

mv64361: Remove extra break from a switch case

PATCH Applied BALATON Zoltan 3 participants 4 messages Jul 12, 2021 – Jul 13, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mv64361: Remove extra break from a switch case

The switch case of writing PCI 1 IO base address had an extra break statement that made part of the code unreachable. This did not cause a problem as guests ususally leave this register at its default value.

Reported-by Coverity (CID 1458135)
---
 hw/pci-host/mv64361.c | 1 -
 1 file changed, 1 deletion(-)
hw/pci-host/mv64361.c +0 -1
index 20510d8680..92b0f5d047 100644
@@ -687,7 +687,6 @@ static void mv64361_write(void *opaque, hwaddr addr, uint64_t val,
     case MV64340_PCI_1_IO_BASE_ADDR:
         s->pci[1].io_base = val & 0x30fffffULL;
         warn_swap_bit(val);
-        break;
         if (!(s->cpu_conf & BIT(27))) {
             s->pci[1].remap[4] = (val & 0xffffULL) << 16;
         }
Signature · 1 line
2.21.4
#1 lore raw
Quoted 5 lines · BALATON Zoltan

The switch case of writing PCI 1 IO base address had an extra break statement that made part of the code unreachable. This did not cause a problem as guests ususally leave this register at its default value.

Reported-by Coverity (CID 1458135)
Fixes dcdf98a9015 ("Add emulation of Marvell MV64361 PPC system

controller")
?

Quoted 18 lines
---
 hw/pci-host/mv64361.c | 1 -
 1 file changed, 1 deletion(-)
hw/pci-host/mv64361.c +0 -1
index 20510d8680..92b0f5d047 100644
@@ -687,7 +687,6 @@ static void mv64361_write(void *opaque, hwaddr addr, uint64_t val,
     case MV64340_PCI_1_IO_BASE_ADDR:
         s->pci[1].io_base = val & 0x30fffffULL;
         warn_swap_bit(val);
-        break;
         if (!(s->cpu_conf & BIT(27))) {
             s->pci[1].remap[4] = (val & 0xffffULL) << 16;
         }
#2 lore raw
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 5 lines · BALATON Zoltan

The switch case of writing PCI 1 IO base address had an extra break statement that made part of the code unreachable. This did not cause a problem as guests ususally leave this register at its default value.

Reported-by Coverity (CID 1458135)
Fixes dcdf98a9015 ("Add emulation of Marvell MV64361 PPC system

controller")
?

Yeah, why not. Feel free to add the Fixes tag when merging, although that's the only commit this file had so far so linking to it does not seem to add much more info.

Regards,
BALATON Zoltan

Quoted 20 lines
Quoted 18 lines
---
 hw/pci-host/mv64361.c | 1 -
 1 file changed, 1 deletion(-)
hw/pci-host/mv64361.c +0 -1
index 20510d8680..92b0f5d047 100644
@@ -687,7 +687,6 @@ static void mv64361_write(void *opaque, hwaddr addr, uint64_t val,
     case MV64340_PCI_1_IO_BASE_ADDR:
         s->pci[1].io_base = val & 0x30fffffULL;
         warn_swap_bit(val);
-        break;
         if (!(s->cpu_conf & BIT(27))) {
             s->pci[1].remap[4] = (val & 0xffffULL) << 16;
         }
Applied
#3 lore raw
In reply to BALATON Zoltan
Quoted 6 lines · BALATON Zoltan

The switch case of writing PCI 1 IO base address had an extra break statement that made part of the code unreachable. This did not cause a problem as guests ususally leave this register at its default value.

Reported-by Coverity (CID 1458135)

Applied to ppc-for-6.1, thanks.

Quoted 16 lines
---
 hw/pci-host/mv64361.c | 1 -
 1 file changed, 1 deletion(-)
hw/pci-host/mv64361.c +0 -1
index 20510d8680..92b0f5d047 100644
@@ -687,7 +687,6 @@ static void mv64361_write(void *opaque, hwaddr addr, uint64_t val,
     case MV64340_PCI_1_IO_BASE_ADDR:
         s->pci[1].io_base = val & 0x30fffffULL;
         warn_swap_bit(val);
-        break;
         if (!(s->cpu_conf & BIT(27))) {
             s->pci[1].remap[4] = (val & 0xffffULL) << 16;
         }
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson