Skip to content

Commit ac5bfa9

Browse files
mwallePratyush Yadav
authored andcommitted
mtd: spi-nor: fix flash probing
Fix flash probing by name. Flash entries without a name are allowed since commit 15eb830 ("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: 2095e7d ("mtd: spi-nor: spansion: Add support for S28HS256T") Reported-by: Jon Hunter <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Tested-by: Jon Hunter <[email protected]> Signed-off-by: Michael Walle <[email protected]> Reviewed-by: Tudor Ambarus <[email protected]> Reviewed-by: Pratyush Yadav <[email protected]> Signed-off-by: Pratyush Yadav <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1dc6cd4 commit ac5bfa9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/mtd/spi-nor/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3281,7 +3281,8 @@ static const struct flash_info *spi_nor_match_name(struct spi_nor *nor,
32813281

32823282
for (i = 0; i < ARRAY_SIZE(manufacturers); i++) {
32833283
for (j = 0; j < manufacturers[i]->nparts; j++) {
3284-
if (!strcmp(name, manufacturers[i]->parts[j].name)) {
3284+
if (manufacturers[i]->parts[j].name &&
3285+
!strcmp(name, manufacturers[i]->parts[j].name)) {
32853286
nor->manufacturer = manufacturers[i];
32863287
return &manufacturers[i]->parts[j];
32873288
}

0 commit comments

Comments
 (0)