Skip to content

Commit

Permalink
spi: intel: Check number of chip selects after reading the descriptor
Browse files Browse the repository at this point in the history
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 <marcin.witkowski@intel.com>
Fixes: 3f03c61 ("spi: intel: Add support for second flash chip")
Cc: stable@vger.kernel.org
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://lore.kernel.org/r/20230215110040.42186-1-mika.westerberg@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Mika Westerberg authored and Mark Brown committed Feb 15, 2023
1 parent 35bba23 commit 574fbb9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/spi/spi-intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1368,14 +1368,14 @@ static int intel_spi_populate_chip(struct intel_spi *ispi)
if (!spi_new_device(ispi->master, &chip))
return -ENODEV;

/* Add the second chip if present */
if (ispi->master->num_chipselect < 2)
return 0;

ret = intel_spi_read_desc(ispi);
if (ret)
return ret;

/* Add the second chip if present */
if (ispi->master->num_chipselect < 2)
return 0;

chip.platform_data = NULL;
chip.chip_select = 1;

Expand Down

0 comments on commit 574fbb9

Please sign in to comment.