mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
mtd: spi-nor: Reset nor->addr_width when SFDP parsing failed
Commit5390a8df76("mtd: spi-nor: add support to non-uniform SFDP SPI NOR flash memories") removed the 'nor->addr_width = 0;' statement when spi_nor_parse_sfdp() returns an error, thus leaving ->addr_width in an undefined state which can cause trouble when spi_nor_scan() checks its value. Reported-by: Cyrille Pitchen <[email protected]> Fixes:5390a8df76("mtd: spi-nor: add support to non-uniform SFDP SPI NOR flash memories") Signed-off-by: Boris Brezillon <[email protected]> Reviewed-by: Tudor Ambarus <[email protected]>
This commit is contained in:
parent
91d7b67000
commit
90c31cb9a8
1 changed files with 4 additions and 2 deletions
|
|
@ -3250,12 +3250,14 @@ static int spi_nor_init_params(struct spi_nor *nor,
|
|||
memcpy(&sfdp_params, params, sizeof(sfdp_params));
|
||||
memcpy(&prev_map, &nor->erase_map, sizeof(prev_map));
|
||||
|
||||
if (spi_nor_parse_sfdp(nor, &sfdp_params))
|
||||
if (spi_nor_parse_sfdp(nor, &sfdp_params)) {
|
||||
nor->addr_width = 0;
|
||||
/* restore previous erase map */
|
||||
memcpy(&nor->erase_map, &prev_map,
|
||||
sizeof(nor->erase_map));
|
||||
else
|
||||
} else {
|
||||
memcpy(params, &sfdp_params, sizeof(*params));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue