mtd: spi-nor: fix flash probing
Subsystems (2)
Michael Walle
maintainerPATCH 1/1 mtd: spi-nor: fix flash probing
Fix flash probing by name. Flash entries without a name are allowed since commit 15eb8303bb42 ("mtd: spi-nor: mark the flash name as obsolete"). But it was just until recently that a flash entry without a name was actually introduced. This triggers a bug in the legacy probe by name path. Skip entries without a name to fix it.
--- drivers/mtd/spi-nor/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/core.c +2 -1
@@ -3281,7 +3281,8 @@ static const struct flash_info *spi_nor_match_name(struct spi_nor *nor,for (i =0 ; i <ARRAY_SIZE (manufacturers); i++) {for (j =0 ; j < manufacturers[i]->nparts; j++) { -if (!strcmp (name, manufacturers[i]->parts[j].name)) { +if (manufacturers[i]->parts[j].name && + !strcmp (name, manufacturers[i]->parts[j].name)) { nor->manufacturer = manufacturers[i];return &manufacturers[i]->parts[j]; }
Signature · 1 line
2.39.2
Quoted 11 lines · Michael Walle
Fix flash probing by name. Flash entries without a name are allowed since commit
15eb8303bb42("mtd: spi-nor: mark the flash name as obsolete"). But it was just until recently that a flash entry without a name was actually introduced. This triggers a bug in the legacy probe by name path. Skip entries without a name to fix it.Fixes 2095e7da8049 ("mtd: spi-nor: spansion: Add support for S28HS256T")Reported-by Jon Hunter <[email protected]>Tested-by Jon Hunter <[email protected]>Signed-off-by Michael Walle <[email protected]>
Quoted 18 lines
--- drivers/mtd/spi-nor/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/mtd/spi-nor/core.c +2
-1@@ -3281,7 +3281,8 @@ static const struct flash_info *spi_nor_match_name(struct spi_nor *nor,for (i =0 ; i <ARRAY_SIZE (manufacturers); i++) {for (j =0 ; j < manufacturers[i]->nparts; j++) { -if (!strcmp (name, manufacturers[i]->parts[j].name)) { +if (manufacturers[i]->parts[j].name && + !strcmp (name, manufacturers[i]->parts[j].name)) { nor->manufacturer = manufacturers[i];return &manufacturers[i]->parts[j]; }
Miquel Raynal
maintainerHey,
[email protected] wrote on Mon, 9 Sep 2024 08:35:23 +0100:
Quoted 7 lines · Michael Walle
Quoted 6 lines
Fix flash probing by name. Flash entries without a name are allowed since commit
15eb8303bb42("mtd: spi-nor: mark the flash name as obsolete"). But it was just until recently that a flash entry without a name was actually introduced. This triggers a bug in the legacy probe by name path. Skip entries without a name to fix it.
Quoted 7 lines
Quoted 5 lines
Fixes 2095e7da8049 ("mtd: spi-nor: spansion: Add support for S28HS256T")Reported-by Jon Hunter <[email protected]>Tested-by Jon Hunter <[email protected]>Signed-off-by Michael Walle <[email protected]>Reviewed-by Tudor Ambarus <[email protected]>
This patch will only apply on top of spi-nor/next. It would spend more time in -next if one of you applied it to this branch before sending the MR?
Cheers,
Miquèl
Quoted 2 lines · Miquel Raynal
Hey,
Hiya
Quoted 15 lines
[email protected] wrote on Mon, 9 Sep 2024 08:35:23 +0100:
Quoted 13 lines · Michael Walle
Quoted 11 lines
Fix flash probing by name. Flash entries without a name are allowed since commit
15eb8303bb42("mtd: spi-nor: mark the flash name as obsolete"). But it was just until recently that a flash entry without a name was actually introduced. This triggers a bug in the legacy probe by name path. Skip entries without a name to fix it.Fixes 2095e7da8049 ("mtd: spi-nor: spansion: Add support for S28HS256T")Reported-by Jon Hunter <[email protected]>Tested-by Jon Hunter <[email protected]>Signed-off-by Michael Walle <[email protected]>
Quoted 6 lines
Quoted 1 line
Reviewed-by Tudor Ambarus <[email protected]>This patch will only apply on top of spi-nor/next. It would spend more time in -next if one of you applied it to this branch before sending the MR?
The patch is intended for spi-nor/next indeed, as the blamed commit was just recently queued. No need to take it through mtd/fixes. Pratyush will take it via spi-nor/next.
Cheers,
ta
Miquel Raynal
maintainerHi Tudor,
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Fixes 2095e7da8049 ("mtd: spi-nor: spansion: Add support for S28HS256T")Reported-by Jon Hunter <[email protected]>Tested-by Jon Hunter <[email protected]>Signed-off-by Michael Walle <[email protected]>Reviewed-by Tudor Ambarus <[email protected]>
Quoted 8 lines
Quoted 4 lines
This patch will only apply on top of spi-nor/next. It would spend more time in -next if one of you applied it to this branch before sending the MR?
The patch is intended for spi-nor/next indeed, as the blamed commit was just recently queued. No need to take it through mtd/fixes. Pratyush will take it via spi-nor/next.
Ok perfect, thanks!
Miquèl
Pratyush Yadav
maintainerQuoted 18 lines · Miquel Raynal
Hi Tudor,
Quoted 16 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Fixes 2095e7da8049 ("mtd: spi-nor: spansion: Add support for S28HS256T")Reported-by Jon Hunter <[email protected]>Tested-by Jon Hunter <[email protected]>Signed-off-by Michael Walle <[email protected]>Quoted 6 lines
Quoted 1 line
Reviewed-by Tudor Ambarus <[email protected]>This patch will only apply on top of spi-nor/next. It would spend more time in -next if one of you applied it to this branch before sending the MR?
The patch is intended for spi-nor/next indeed, as the blamed commit was just recently queued. No need to take it through mtd/fixes. Pratyush will take it via spi-nor/next.
Right.
I have applied this to spi-nor/next. I plan to send the pull request by Wednesday/Thursday so it should get at least a couple days of testing in linux-next.
Quoted 2 lines
Ok perfect, thanks!
Signature · 2 lines
Regards, Pratyush Yadav
Hi Michael,
Thanks for the quick fix!
Quoted 5 lines · Michael Walle
Fix flash probing by name. Flash entries without a name are allowed since commit
15eb8303bb42("mtd: spi-nor: mark the flash name as obsolete"). But it was just until recently that a flash entry without a name was actually introduced. This triggers a bug in the legacy probe by name path. Skip entries without a name to fix it.
We also use name in a couple other places:
1. spi_nor_get_flash_info() prints jinfo->name and info->name() in the dev_warn() call.
2. spi_nor_params_show() prints nor->info->name for the debugfs entry.
Since both of these are prints, it should probably be fine since they should be converted to "(null)" instead. Still, something we should fix. I don't think those are critical so those can be fixed as follow up patches. I unfortunately am swamped and don't have the time to fix them right now.
I also did a quick check to make sure we don't have other flashes without a name.
Applied to spi-nor/next. Thanks!
Quoted 6 lines
Fixes 2095e7da8049 ("mtd: spi-nor: spansion: Add support for S28HS256T")Reported-by Jon Hunter <[email protected]>Tested-by Jon Hunter <[email protected]>Signed-off-by Michael Walle <[email protected]>
[...]
Signature · 2 lines
Regards, Pratyush Yadav