Skip to content

Commit

Permalink
flash/nor/sfdp, stmqspi: use native type for buffer size
Browse files Browse the repository at this point in the history
Two different sizes uint8_t and uint32_t was used for this value
without a good reason.

Signed-off-by: Tomas Vanek <[email protected]>
Change-Id: I4bb60cc5397ffd0d37e7034e3930e62793140c8d
Reviewed-on: https://review.openocd.org/c/openocd/+/8439
Reviewed-by: Andreas Bolsch <[email protected]>
Tested-by: jenkins
  • Loading branch information
tom-van authored and borneoa committed Sep 15, 2024
1 parent 1dc3d7e commit ea28f96
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/flash/nor/sfdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ int spi_sfdp(struct flash_bank *bank, struct flash_device *dev,
goto err;

for (k = 0; k < nph; k++) {
uint8_t words = (pheaders[k].revision >> 24) & 0xFF;
unsigned int words = (pheaders[k].revision >> 24) & 0xFF;
uint16_t id = (((pheaders[k].ptr) >> 16) & 0xFF00) | (pheaders[k].revision & 0xFF);
uint32_t ptr = pheaders[k].ptr & 0xFFFFFF;

Expand Down
2 changes: 1 addition & 1 deletion src/flash/nor/sfdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* buffer contents is supposed to be returned in ***host*** endianness */
typedef int (*read_sfdp_block_t)(struct flash_bank *bank, uint32_t addr,
uint32_t words, uint32_t *buffer);
unsigned int words, uint32_t *buffer);

extern int spi_sfdp(struct flash_bank *bank, struct flash_device *dev,
read_sfdp_block_t read_sfdp_block);
Expand Down
4 changes: 2 additions & 2 deletions src/flash/nor/stmqspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,7 @@ static int find_sfdp_dummy(struct flash_bank *bank, int len)

/* Read SFDP parameter block */
static int read_sfdp_block(struct flash_bank *bank, uint32_t addr,
uint32_t words, uint32_t *buffer)
unsigned int words, uint32_t *buffer)
{
struct target *target = bank->target;
struct stmqspi_flash_bank *stmqspi_info = bank->driver_priv;
Expand Down Expand Up @@ -1848,7 +1848,7 @@ static int read_sfdp_block(struct flash_bank *bank, uint32_t addr,
}
}

LOG_DEBUG("%s: addr=0x%08" PRIx32 " words=0x%08" PRIx32 " dummy=%u",
LOG_DEBUG("%s: addr=0x%08" PRIx32 " words=0x%08x dummy=%u",
__func__, addr, words, *dummy);

/* Abort any previous operation */
Expand Down

0 comments on commit ea28f96

Please sign in to comment.