From 8fede89f853a7bfc671f9d8f069ccfe4190061f3 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 22 May 2020 16:50:05 +0100 Subject: [PATCH] spi: Make spi_delay_exec() warn if called from atomic context If the delay used is long enough the spi_delay_exec() will use a sleeping function to implement it. Add a might_sleep() here to help avoid callers using this from an atomic context and running into problems at runtime on other systems. Suggested-by: Serge Semin Signed-off-by: Mark Brown Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20200522155005.46099-1-broonie@kernel.org Signed-off-by: Mark Brown --- drivers/spi/spi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d32bdc6..c765c96 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1160,6 +1160,8 @@ int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer) { int delay; + might_sleep(); + if (!_delay) return -EINVAL; -- 2.7.4