[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 41/43] vt82c686: Simplify by returning earlier
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 41/43] vt82c686: Simplify by returning earlier |
Date: |
Sun, 21 Feb 2021 15:34:30 +0100 |
From: BALATON Zoltan <balaton@eik.bme.hu>
By returning earlier we can remove the 'can_write' boolean variable.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-Id:
<15b2968fd300a12d06b42368d084f6f80d3c3be5.1610223397.git.balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
[PMD: Split original patch in 5, this is part 3/5]
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/isa/vt82c686.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index 2f69b4d531f..2bd10d91013 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -258,7 +258,6 @@ static void superio_cfg_write(void *opaque, hwaddr addr,
uint64_t data,
{
SuperIOConfig *sc = opaque;
uint8_t idx = sc->regs[0];
- bool can_write = true;
if (addr == 0x3f0) { /* config index register */
idx = data & 0xff;
@@ -276,15 +275,13 @@ static void superio_cfg_write(void *opaque, hwaddr addr,
uint64_t data,
case 0xf7:
case 0xf9 ... 0xfb:
case 0xfd ... 0xff:
- can_write = false;
- break;
+ /* ignore write to read only registers */
+ return;
/* case 0xe6 ... 0xe8: Should set base port of parallel and serial */
default:
break;
}
- if (can_write) {
- sc->regs[idx] = data & 0xff;
- }
+ sc->regs[idx] = data & 0xff;
}
static uint64_t superio_cfg_read(void *opaque, hwaddr addr, unsigned size)
--
2.26.2
- [PULL 30/43] vt82c686: Fix SMBus IO base and configuration registers, (continued)
- [PULL 30/43] vt82c686: Fix SMBus IO base and configuration registers, Philippe Mathieu-Daudé, 2021/02/21
- [PULL 33/43] vt82c686: Correctly reset all registers to default values on reset, Philippe Mathieu-Daudé, 2021/02/21
- [PULL 34/43] vt82c686: Fix up power management io base and config, Philippe Mathieu-Daudé, 2021/02/21
- [PULL 35/43] vt82c686: Set user_creatable=false for VT82C686B_PM, Philippe Mathieu-Daudé, 2021/02/21
- [PULL 36/43] vt82c686: Make vt82c686b-pm an abstract base class and add vt8231-pm based on it, Philippe Mathieu-Daudé, 2021/02/21
- [PULL 37/43] vt82c686: Simplify vt82c686b_realize(), Philippe Mathieu-Daudé, 2021/02/21
- [PULL 38/43] vt82c686: Move creation of ISA devices to the ISA bridge, Philippe Mathieu-Daudé, 2021/02/21
- [PULL 39/43] vt82c686: Remove index field of SuperIOConfig, Philippe Mathieu-Daudé, 2021/02/21
- [PULL 40/43] vt82c686: Reduce indentation by returning early, Philippe Mathieu-Daudé, 2021/02/21
- [PULL 42/43] vt82c686: Log superio_cfg unimplemented accesses, Philippe Mathieu-Daudé, 2021/02/21
- [PULL 41/43] vt82c686: Simplify by returning earlier,
Philippe Mathieu-Daudé <=
- [PULL 43/43] vt82c686: Fix superio_cfg_{read,write}() functions, Philippe Mathieu-Daudé, 2021/02/21
- Re: [PULL 00/43] MIPS patches for 2021-02-21, Philippe Mathieu-Daudé, 2021/02/21