summaryrefslogtreecommitdiffstats
path: root/jedec.c
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2023-02-26 17:01:59 +1100
committerThomas Heijligen <src@posteo.de>2023-02-27 10:23:33 +0000
commit15d348feff896fd17e44b4158afba220a4a67ff9 (patch)
tree4bd28eed9d8945939a04b124a2084bc3eb861f74 /jedec.c
parent2c03317a4bd69278a48498e99869d1ac2bd531f0 (diff)
downloadflashrom-15d348feff896fd17e44b4158afba220a4a67ff9.tar.gz
flashrom-15d348feff896fd17e44b4158afba220a4a67ff9.tar.bz2
flashrom-15d348feff896fd17e44b4158afba220a4a67ff9.zip
jedec.c: Add a little more const correctness
Change-Id: Ic9a76ce3734bd83399c95478a7c0bfc081211124 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/73283 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
Diffstat (limited to 'jedec.c')
-rw-r--r--jedec.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/jedec.c b/jedec.c
index 2cdde617f..bb617e00e 100644
--- a/jedec.c
+++ b/jedec.c
@@ -123,7 +123,7 @@ static void start_program_jedec_common(const struct flashctx *flash)
int probe_jedec_29gl(struct flashctx *flash)
{
const unsigned int mask = getaddrmask(flash->chip);
- chipaddr bios = flash->virtual_memory;
+ const chipaddr bios = flash->virtual_memory;
const struct flashchip *chip = flash->chip;
/* Reset chip to a clean slate */
@@ -381,9 +381,8 @@ int write_jedec_1(struct flashctx *flash, const uint8_t *src, unsigned int start
unsigned int i;
int failed = 0;
chipaddr dst = flash->virtual_memory + start;
- chipaddr olddst;
+ const chipaddr olddst = dst;
- olddst = dst;
for (i = 0; i < len; i++) {
if (write_byte_program_jedec_common(flash, src, dst))
failed = 1;
@@ -452,8 +451,8 @@ int write_jedec(struct flashctx *flash, const uint8_t *buf, unsigned int start,
* write_jedec have page_size set to max_writechunk_size, so
* we're OK for now.
*/
- unsigned int page_size = flash->chip->page_size;
- unsigned int nwrites = (start + len - 1) / page_size;
+ const unsigned int page_size = flash->chip->page_size;
+ const unsigned int nwrites = (start + len - 1) / page_size;
/* Warning: This loop has a very unusual condition and body.
* The loop needs to go through each page with at least one affected