[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 14/27] hw/block/pflash_cfi02: Remove pointless local
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [PULL 14/27] hw/block/pflash_cfi02: Remove pointless local variable |
Date: |
Mon, 1 Jul 2019 21:58:59 -0300 |
We can directly use pfl->total_len, remove the local 'chip_len'
variable.
Signed-off-by: Stephen Checkoway <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
[PMD: Extracted from bigger patch]
Reviewed-by: Alistair Francis <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/block/pflash_cfi02.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
index 4be3837be5..1a794fa83c 100644
--- a/hw/block/pflash_cfi02.c
+++ b/hw/block/pflash_cfi02.c
@@ -409,7 +409,7 @@ static void pflash_write(void *opaque, hwaddr offset,
uint64_t value,
/* Chip erase */
DPRINTF("%s: start chip erase\n", __func__);
if (!pfl->ro) {
- memset(pfl->storage, 0xFF, pfl->chip_len);
+ memset(pfl->storage, 0xff, pfl->chip_len);
pflash_update(pfl, 0, pfl->chip_len);
}
set_dq7(pfl, 0x00);
@@ -490,7 +490,6 @@ static const MemoryRegionOps pflash_cfi02_ops = {
static void pflash_cfi02_realize(DeviceState *dev, Error **errp)
{
PFlashCFI02 *pfl = PFLASH_CFI02(dev);
- uint32_t chip_len;
int ret;
Error *local_err = NULL;
@@ -507,18 +506,17 @@ static void pflash_cfi02_realize(DeviceState *dev, Error
**errp)
return;
}
- chip_len = pfl->sector_len * pfl->nb_blocs;
+ pfl->chip_len = pfl->sector_len * pfl->nb_blocs;
memory_region_init_rom_device(&pfl->orig_mem, OBJECT(pfl),
&pflash_cfi02_ops, pfl, pfl->name,
- chip_len, &local_err);
+ pfl->chip_len, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
pfl->storage = memory_region_get_ram_ptr(&pfl->orig_mem);
- pfl->chip_len = chip_len;
if (pfl->blk) {
uint64_t perm;
@@ -533,8 +531,8 @@ static void pflash_cfi02_realize(DeviceState *dev, Error
**errp)
}
if (pfl->blk) {
- if (!blk_check_size_and_read_all(pfl->blk, pfl->storage, chip_len,
- errp)) {
+ if (!blk_check_size_and_read_all(pfl->blk, pfl->storage,
+ pfl->chip_len, errp)) {
vmstate_unregister_ram(&pfl->orig_mem, DEVICE(pfl));
return;
}
@@ -594,7 +592,7 @@ static void pflash_cfi02_realize(DeviceState *dev, Error
**errp)
/* Max timeout for chip erase */
pfl->cfi_table[0x26] = 0x0D;
/* Device size */
- pfl->cfi_table[0x27] = ctz32(chip_len);
+ pfl->cfi_table[0x27] = ctz32(pfl->chip_len);
/* Flash device interface (8 & 16 bits) */
pfl->cfi_table[0x28] = 0x02;
pfl->cfi_table[0x29] = 0x00;
--
2.20.1
- [Qemu-devel] [PULL 04/27] hw/block/pflash_cfi02: Fix debug format string, (continued)
- [Qemu-devel] [PULL 04/27] hw/block/pflash_cfi02: Fix debug format string, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 05/27] hw/block/pflash_cfi02: Add an enum to define the write cycles, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 08/27] hw/block/pflash_cfi02: Use the ldst API in pflash_write(), Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 06/27] hw/block/pflash_cfi02: Add helpers to manipulate the status bits, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 07/27] hw/block/pflash_cfi02: Simplify a statement using fall through, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 15/27] hw/block/pflash_cfi02: Document the current CFI values, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 20/27] hw/block/pflash_cfi02: Split if() condition, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 25/27] hw/block/pflash_cfi02: Use chip erase time specified in the CFI table, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 23/27] hw/block/pflash_cfi02: Implement multi-sector erase, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 18/27] hw/block/pflash_cfi02: Implement nonuniform sector sizes, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 14/27] hw/block/pflash_cfi02: Remove pointless local variable,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PULL 22/27] hw/block/pflash_cfi02: Fix reset command not ignored during erase, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 11/27] hw/block/pflash_cfi02: Unify the MemoryRegionOps, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 24/27] hw/block/pflash_cfi02: Implement erase suspend/resume, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 19/27] hw/block/pflash_cfi02: Extract pflash_regions_count(), Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 13/27] tests/pflash-cfi02: Refactor to support testing multiple configurations, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 09/27] hw/block/pflash_cfi02: Use the ldst API in pflash_read(), Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 10/27] hw/block/pflash_cfi02: Extract the pflash_data_read() function, Philippe Mathieu-Daudé, 2019/07/01
- [Qemu-devel] [PULL 27/27] hw/block/pflash_cfi02: Reduce I/O accesses to 16-bit, Philippe Mathieu-Daudé, 2019/07/01