Skip to content

Commit 0d62c64

Browse files
tlebbroonie
authored andcommitted
spi: cadence-qspi: assert each subnode flash CS is valid
Check each flash CS against the num-cs property from devicetree. Fallback to the driver max supported value (CQSPI_MAX_CHIPSELECT) if num-cs isn't present. cqspi->num_chipselect is set in cqspi_of_get_pdata() to the num-cs devicetree property, or to CQSPI_MAX_CHIPSELECT if num-cs is not set. Signed-off-by: Théo Lebrun <[email protected]> Reviewed-by: Dhruva Gole <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent afd2a4a commit 0d62c64

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/spi/spi-cadence-quadspi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,7 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi)
16351635
return ret;
16361636
}
16371637

1638-
if (cs >= CQSPI_MAX_CHIPSELECT) {
1638+
if (cs >= cqspi->num_chipselect) {
16391639
dev_err(dev, "Chip select %d out of range.\n", cs);
16401640
of_node_put(np);
16411641
return -EINVAL;

0 commit comments

Comments
 (0)