Messages in this thread Patch in this message | | | From | Tudor Ambarus <> | Subject | [PATCH] spi: Limit the spi device max speed to controller's max speed | Date | Wed, 9 Dec 2020 19:35:14 +0200 |
| |
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> --- drivers/spi/spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index cd3c395b4e90..51d7c004fbab 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3378,7 +3378,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); -- 2.25.1
| |