Edward O'Callaghan has uploaded this change for review.

View Change

jedec.c: Make getaddrmask() ret const correct

Change-Id: If9701a6d56159d0dfc047aa91b2a80c80fb33e5f
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M jedec.c
1 file changed, 17 insertions(+), 19 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/99/72499/1
diff --git a/jedec.c b/jedec.c
index c4ee0c7..d3665b8 100644
--- a/jedec.c
+++ b/jedec.c
@@ -121,7 +121,7 @@

int probe_jedec_29gl(struct flashctx *flash)
{
- unsigned int mask = getaddrmask(flash->chip);
+ const unsigned int mask = getaddrmask(flash->chip);
chipaddr bios = flash->virtual_memory;
const struct flashchip *chip = flash->chip;

@@ -412,9 +412,7 @@
int failed = 0;
chipaddr dst = flash->virtual_memory + start;
chipaddr olddst;
- unsigned int mask;
-
- mask = getaddrmask(flash->chip);
+ const unsigned int mask = getaddrmask(flash->chip);

olddst = dst;
for (i = 0; i < len; i++) {
@@ -438,9 +436,7 @@
chipaddr bios = flash->virtual_memory;
chipaddr dst = bios + start;
chipaddr d = dst;
- unsigned int mask;
-
- mask = getaddrmask(flash->chip);
+ const unsigned int mask = getaddrmask(flash->chip);

retry:
/* Issue JEDEC Start Program command */
@@ -518,9 +514,7 @@
int erase_chip_block_jedec(struct flashctx *flash, unsigned int addr,
unsigned int blocksize)
{
- unsigned int mask;
-
- mask = getaddrmask(flash->chip);
+ const unsigned int mask = getaddrmask(flash->chip);
if ((addr != 0) || (blocksize != flash->chip->total_size * 1024)) {
msg_cerr("%s called with incorrect arguments\n",
__func__);
@@ -531,27 +525,21 @@

int probe_jedec(struct flashctx *flash)
{
- unsigned int mask;
-
- mask = getaddrmask(flash->chip);
+ const unsigned int mask = getaddrmask(flash->chip);
return probe_jedec_common(flash, mask);
}

int erase_sector_jedec(struct flashctx *flash, unsigned int page,
unsigned int size)
{
- unsigned int mask;
-
- mask = getaddrmask(flash->chip);
+ const unsigned int mask = getaddrmask(flash->chip);
return erase_sector_jedec_common(flash, page, size, mask);
}

int erase_block_jedec(struct flashctx *flash, unsigned int page,
unsigned int size)
{
- unsigned int mask;
-
- mask = getaddrmask(flash->chip);
+ const unsigned int mask = getaddrmask(flash->chip);
return erase_block_jedec_common(flash, page, size, mask);
}


To view, visit change 72499. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If9701a6d56159d0dfc047aa91b2a80c80fb33e5f
Gerrit-Change-Number: 72499
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-MessageType: newchange