提交 cd5e6d79 编写于 作者: T Tudor.Ambarus@microchip.com 提交者: Boris Brezillon

mtd: spi-nor: don't drop sfdp data if optional parsers fail

JESD216C states that just the Basic Flash Parameter Table is mandatory.
Already defined (or future) additional parameter headers and tables are
optional.

Don't drop already collected sfdp data in case an optional table
parser fails. In case of failing, each optional parser is responsible
to roll back to the previously known spi_nor data.

Fixes: b038e8e3 ("mtd: spi-nor: parse SFDP Sector Map Parameter Table")
Reported-by: NYogesh Gaur <yogeshnarayan.gaur@nxp.com>
Suggested-by: NBoris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com>
Tested-by: NYogesh Gaur <yogeshnarayan.gaur@nxp.com>
Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com>
上级 ccda4af0
......@@ -3125,7 +3125,7 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor,
if (err)
goto exit;
/* Parse other parameter headers. */
/* Parse optional parameter tables. */
for (i = 0; i < header.nph; i++) {
param_header = &param_headers[i];
......@@ -3138,8 +3138,17 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor,
break;
}
if (err)
goto exit;
if (err) {
dev_warn(dev, "Failed to parse optional parameter table: %04x\n",
SFDP_PARAM_HEADER_ID(param_header));
/*
* Let's not drop all information we extracted so far
* if optional table parsers fail. In case of failing,
* each optional parser is responsible to roll back to
* the previously known spi_nor data.
*/
err = 0;
}
}
exit:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册