OSDN Git Service

spi: imx: add a check for speed_hz before calculating the clock
authorClark Wang <xiaoning.wang@nxp.com>
Thu, 8 Apr 2021 10:33:47 +0000 (18:33 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 9 Apr 2021 12:44:01 +0000 (13:44 +0100)
commit4df2f5e1372e9eec8f9e1b4a3025b9be23487d36
tree626ba4532247f046e6af6f2cfb158512f9e3f696
parenta23faea76d4cf5f75decb574491e66f9ecd707e7
spi: imx: add a check for speed_hz before calculating the clock

When some drivers use spi to send data, spi_transfer->speed_hz is
not assigned. If spidev->max_speed_hz is not assigned as well, it
will cause an error in configuring the clock.
Add a check for these two values before configuring the clock. An
error will be returned when they are not assigned.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Link: https://lore.kernel.org/r/20210408103347.244313-2-xiaoning.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-imx.c