diff mbox series

spi: intel: Check number of chip selects after reading the descriptor

Message ID 20230215110040.42186-1-mika.westerberg@linux.intel.com (mailing list archive)
State Accepted
Commit 574fbb95cd9d88bdc9c9c4c64223a38a61d7de9a
Headers show
Series spi: intel: Check number of chip selects after reading the descriptor | expand

Commit Message

Mika Westerberg Feb. 15, 2023, 11 a.m. UTC
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: 3f03c618bebb ("spi: intel: Add support for second flash chip")
Cc: stable@vger.kernel.org
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/spi/spi-intel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Mark Brown Feb. 15, 2023, 5:08 p.m. UTC | #1
On Wed, 15 Feb 2023 13:00:40 +0200, Mika Westerberg wrote:
> 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.
> 
> 

Applied to

   broonie/spi.git for-next

Thanks!

[1/1] spi: intel: Check number of chip selects after reading the descriptor
      commit: 574fbb95cd9d88bdc9c9c4c64223a38a61d7de9a

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/spi/spi-intel.c b/drivers/spi/spi-intel.c
index f619212b0d5c..627287925fed 100644
--- a/drivers/spi/spi-intel.c
+++ b/drivers/spi/spi-intel.c
@@ -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;