From: Mark Brown Date: Fri, 22 May 2020 15:50:05 +0000 (+0100) Subject: spi: Make spi_delay_exec() warn if called from atomic context X-Git-Tag: v5.8-rc1~239^2^2~18 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8fede89f853a7bfc671f9d8f069ccfe4190061f3;p=tomoyo%2Ftomoyo-test1.git 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 --- diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d32bdc6cbf66..c765c966cc8e 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;