2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-17 09:43:59 +08:00

spi: Limit the spi device max speed to controller's max speed

Make sure the max_speed_hz of spi_device does not override
the max_speed_hz of controller.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/r/20201209173514.93328-1-tudor.ambarus@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Tudor Ambarus 2020-12-09 19:35:14 +02:00 committed by Mark Brown
parent e748edd984
commit 9326e4f1e5
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -3369,7 +3369,8 @@ int spi_setup(struct spi_device *spi)
if (status)
return status;
if (!spi->max_speed_hz)
if (!spi->max_speed_hz ||
spi->max_speed_hz > spi->controller->max_speed_hz)
spi->max_speed_hz = spi->controller->max_speed_hz;
mutex_lock(&spi->controller->io_mutex);