summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-mem.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2022-05-11 21:48:07 +0300
committerMark Brown <broonie@kernel.org>2022-05-11 21:48:07 +0300
commitd5efbfc5210cc7ce8e413278da0dc4b7ccbe5bb7 (patch)
tree723be8852798ef09e5e9b253fc9efbba75917fe2 /drivers/spi/spi-mem.c
parent0d8688298d6a43f2e187dad1e45871248123764f (diff)
parentae16cc18f37bcdea7d4ef57a5e526a60b09a1506 (diff)
downloadlinux-d5efbfc5210cc7ce8e413278da0dc4b7ccbe5bb7.tar.xz
spi: stm32-qspi: flags management fixes
Merge series from patrice.chotard@foss.st.com <patrice.chotard@foss.st.com> Patrice Chotard <patrice.chotard@foss.st.com>: From: Patrice Chotard <patrice.chotard@foss.st.com> This series update flags management in the following cases: - In APM mode, don't take care of TCF and TEF flags - Always check TCF flag in stm32_qspi_wait_cmd() - Don't check BUSY flag when sending new command
Diffstat (limited to 'drivers/spi/spi-mem.c')
-rw-r--r--drivers/spi/spi-mem.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 7d7091aa0c22..e8de4f5017cd 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -10,6 +10,7 @@
#include <linux/pm_runtime.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi-mem.h>
+#include <linux/sched/task_stack.h>
#include "internals.h"
@@ -211,6 +212,15 @@ static int spi_mem_check_op(const struct spi_mem_op *op)
!spi_mem_buswidth_is_valid(op->data.buswidth))
return -EINVAL;
+ /* Buffers must be DMA-able. */
+ if (WARN_ON_ONCE(op->data.dir == SPI_MEM_DATA_IN &&
+ object_is_on_stack(op->data.buf.in)))
+ return -EINVAL;
+
+ if (WARN_ON_ONCE(op->data.dir == SPI_MEM_DATA_OUT &&
+ object_is_on_stack(op->data.buf.out)))
+ return -EINVAL;
+
return 0;
}