Skip to content

Commit 574fbb9

Browse files
westeribroonie
authored andcommitted
spi: intel: Check number of chip selects after reading the descriptor
The flash decriptor contains the number of flash components that we use to figure out how many flash chips there are connected. Therefore we need to read it first before deciding how many chip selects the controller has. Reported-by: Marcin Witkowski <[email protected]> Fixes: 3f03c61 ("spi: intel: Add support for second flash chip") Cc: [email protected] Signed-off-by: Mika Westerberg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 35bba23 commit 574fbb9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/spi/spi-intel.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,14 +1368,14 @@ static int intel_spi_populate_chip(struct intel_spi *ispi)
13681368
if (!spi_new_device(ispi->master, &chip))
13691369
return -ENODEV;
13701370

1371-
/* Add the second chip if present */
1372-
if (ispi->master->num_chipselect < 2)
1373-
return 0;
1374-
13751371
ret = intel_spi_read_desc(ispi);
13761372
if (ret)
13771373
return ret;
13781374

1375+
/* Add the second chip if present */
1376+
if (ispi->master->num_chipselect < 2)
1377+
return 0;
1378+
13791379
chip.platform_data = NULL;
13801380
chip.chip_select = 1;
13811381

0 commit comments

Comments
 (0)