projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
47e0255
)
spi: lpspi: run transfer speed_hz sanity check
author
Clark Wang
<xiaoning.wang@nxp.com>
Fri, 5 May 2023 06:41:59 +0000
(14:41 +0800)
committer
Mark Brown
<broonie@kernel.org>
Mon, 8 May 2023 00:11:47 +0000
(09:11 +0900)
Avoid config.speed_hz is 0 when it is a divisor.
Signed-off-by: Han Xu <han.xu@nxp.com
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com
Link:
https://lore.kernel.org/r/20230505064159.3964473-1-xiaoning.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org
drivers/spi/spi-fsl-lpspi.c
patch
|
blob
|
history
diff --git
a/drivers/spi/spi-fsl-lpspi.c
b/drivers/spi/spi-fsl-lpspi.c
index f2341ab99556649fa308931afc7ede4e8bc7cd52..d9f8231bcea82037e83094dda877ec7153829e75 100644
(file)
--- a/
drivers/spi/spi-fsl-lpspi.c
+++ b/
drivers/spi/spi-fsl-lpspi.c
@@
-303,6
+303,12
@@
static int fsl_lpspi_set_bitrate(struct fsl_lpspi_data *fsl_lpspi)
perclk_rate = clk_get_rate(fsl_lpspi->clk_per);
+ if (!config.speed_hz) {
+ dev_err(fsl_lpspi->dev,
+ "error: the transmission speed provided is 0!\n");
+ return -EINVAL;
+ }
+
if (config.speed_hz > perclk_rate / 2) {
dev_err(fsl_lpspi->dev,
"per-clk should be at least two times of transfer speed");