]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mmc: core: Only set maximum DMA segment size if DMA is supported
authorGuenter Roeck <linux@roeck-us.net>
Tue, 24 Sep 2024 21:01:23 +0000 (14:01 -0700)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 2 Oct 2024 23:23:57 +0000 (01:23 +0200)
Since upstream commit 334304ac2bac ("dma-mapping: don't return errors
from dma_set_max_seg_size") calling dma_set_max_seg_size() on a device
not supporting DMA results in a warning traceback. This is seen when
booting the sifive_u machine from SD. The underlying SPI controller
(sifive,spi0 compatible) explicitly sets dma_mask to NULL.

Avoid the backtrace by only calling dma_set_max_seg_size() if DMA is
supported.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Fixes: 334304ac2bac ("dma-mapping: don't return errors from dma_set_max_seg_size")
Link: https://lore.kernel.org/r/20240924210123.2288529-1-linux@roeck-us.net
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/queue.c

index d0b3ca8a11f07172041e4ae634e560f96071b486..4d6844261912047b6bc407ecf4ce16b3854ee415 100644 (file)
@@ -388,7 +388,8 @@ static struct gendisk *mmc_alloc_disk(struct mmc_queue *mq,
 
        blk_queue_rq_timeout(mq->queue, 60 * HZ);
 
-       dma_set_max_seg_size(mmc_dev(host), queue_max_segment_size(mq->queue));
+       if (mmc_dev(host)->dma_parms)
+               dma_set_max_seg_size(mmc_dev(host), queue_max_segment_size(mq->queue));
 
        INIT_WORK(&mq->recovery_work, mmc_mq_recovery_handler);
        INIT_WORK(&mq->complete_work, mmc_blk_mq_complete_work);