[bug report] spi: stm32: use dmaengine_terminate_{a}sync instead of _all

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hello Alain Volmat,

The patch 4f2b39dc2d14: "spi: stm32: use dmaengine_terminate_{a}sync
instead of _all" from Jun 15, 2023 (linux-next), leads to the
following Smatch static checker warning:

	include/linux/dmaengine.h:1185 dmaengine_terminate_sync()
	warn: sleeping in atomic context

    1177 static inline int dmaengine_terminate_sync(struct dma_chan *chan)
    1178 {
    1179         int ret;
    1181         ret = dmaengine_terminate_async(chan);
    1182         if (ret)
    1183                 return ret;
--> 1185         dmaengine_synchronize(chan);
    1187         return 0;
    1188 }

The problem is that the error handling code calls dmaengine_terminate_sync()
while holding a spinlock.

stm32_spi_transfer_one_dma() <- disables preempt
-> dmaengine_terminate_sync()

It used to be dmaengine_terminate_all().  Probably that was buggy as
well, but just too complicated for Smatch to warn about.  Another idea
is to call dmaengine_terminate_async() (I don't know the code at all,
possibly that is a stupid idea).

dan carpenter

[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux