static int sdmmc_idma_setup(struct mmci_host *host)
 {
        struct sdmmc_idma *idma;
+       struct device *dev = mmc_dev(host->mmc);
 
-       idma = devm_kzalloc(mmc_dev(host->mmc), sizeof(*idma), GFP_KERNEL);
+       idma = devm_kzalloc(dev, sizeof(*idma), GFP_KERNEL);
        if (!idma)
                return -ENOMEM;
 
        host->dma_priv = idma;
 
        if (host->variant->dma_lli) {
-               idma->sg_cpu = dmam_alloc_coherent(mmc_dev(host->mmc),
-                                                  SDMMC_LLI_BUF_LEN,
+               idma->sg_cpu = dmam_alloc_coherent(dev, SDMMC_LLI_BUF_LEN,
                                                   &idma->sg_dma, GFP_KERNEL);
                if (!idma->sg_cpu) {
-                       dev_err(mmc_dev(host->mmc),
-                               "Failed to alloc IDMA descriptor\n");
+                       dev_err(dev, "Failed to alloc IDMA descriptor\n");
                        return -ENOMEM;
                }
                host->mmc->max_segs = SDMMC_LLI_BUF_LEN /
                host->mmc->max_seg_size = host->mmc->max_req_size;
        }
 
-       return 0;
+       return dma_set_max_seg_size(dev, host->mmc->max_seg_size);
 }
 
 static int sdmmc_idma_start(struct mmci_host *host, unsigned int *datactrl)