@@ -944,7 +944,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
master->dev.of_node = pdev->dev.of_node;
master->bus_num = pdev->id;
- master->num_chipselect = master->dev.of_node ? 0 : 4;
+ master->num_chipselect = 4;
master->setup = atmel_spi_setup;
master->transfer = atmel_spi_transfer;
master->cleanup = atmel_spi_cleanup;
@@ -1070,7 +1070,7 @@ static int of_spi_register_master(struct spi_master *master)
master->num_chipselect = max(nb, master->num_chipselect);
if (nb < 1)
- return 0;
+ nb = master->num_chipselect;
cs = devm_kzalloc(&master->dev,
sizeof(int) * master->num_chipselect,
if the spi property "cs-gpios" is set as below: cs-gpios = <0>, <&pioC 11 0>, <0>, <0>; the master->num_chipselect will wrongly be set to 0, and the spi fail to probe. Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Cc: spi-devel-general@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org --- drivers/spi/spi-atmel.c | 2 +- drivers/spi/spi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)