Skip to content

Commit 334304a

Browse files
author
Christoph Hellwig
committed
dma-mapping: don't return errors from dma_set_max_seg_size
A NULL dev->dma_parms indicates either a bus that is not DMA capable or grave bug in the implementation of the bus code. There isn't much the driver can do in terms of error handling for either case, so just warn and continue as DMA operations will fail anyway. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Robin Murphy <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Acked-by: Ulf Hansson <[email protected]> # For MMC
1 parent 560a861 commit 334304a

File tree

13 files changed

+17
-51
lines changed

13 files changed

+17
-51
lines changed

drivers/accel/qaic/qaic_drv.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,7 @@ static int init_pci(struct qaic_device *qdev, struct pci_dev *pdev)
447447
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
448448
if (ret)
449449
return ret;
450-
ret = dma_set_max_seg_size(&pdev->dev, UINT_MAX);
451-
if (ret)
452-
return ret;
450+
dma_set_max_seg_size(&pdev->dev, UINT_MAX);
453451

454452
qdev->bar_0 = devm_ioremap_resource(&pdev->dev, &pdev->resource[0]);
455453
if (IS_ERR(qdev->bar_0))

drivers/dma/idma64.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,7 @@ static int idma64_probe(struct idma64_chip *chip)
598598

599599
idma64->dma.dev = chip->sysdev;
600600

601-
ret = dma_set_max_seg_size(idma64->dma.dev, IDMA64C_CTLH_BLOCK_TS_MASK);
602-
if (ret)
603-
return ret;
601+
dma_set_max_seg_size(idma64->dma.dev, IDMA64C_CTLH_BLOCK_TS_MASK);
604602

605603
ret = dma_async_device_register(&idma64->dma);
606604
if (ret)

drivers/dma/pl330.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3163,10 +3163,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
31633163
* This is the limit for transfers with a buswidth of 1, larger
31643164
* buswidths will have larger limits.
31653165
*/
3166-
ret = dma_set_max_seg_size(&adev->dev, 1900800);
3167-
if (ret)
3168-
dev_err(&adev->dev, "unable to set the seg size\n");
3169-
3166+
dma_set_max_seg_size(&adev->dev, 1900800);
31703167

31713168
init_pl330_debugfs(pl330);
31723169
dev_info(&adev->dev,

drivers/dma/qcom/bam_dma.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,11 +1325,7 @@ static int bam_dma_probe(struct platform_device *pdev)
13251325

13261326
/* set max dma segment size */
13271327
bdev->common.dev = bdev->dev;
1328-
ret = dma_set_max_seg_size(bdev->common.dev, BAM_FIFO_SIZE);
1329-
if (ret) {
1330-
dev_err(bdev->dev, "cannot set maximum segment size\n");
1331-
goto err_bam_channel_exit;
1332-
}
1328+
dma_set_max_seg_size(bdev->common.dev, BAM_FIFO_SIZE);
13331329

13341330
platform_set_drvdata(pdev, bdev);
13351331

drivers/dma/sh/rcar-dmac.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,9 +1868,7 @@ static int rcar_dmac_probe(struct platform_device *pdev)
18681868

18691869
dmac->dev = &pdev->dev;
18701870
platform_set_drvdata(pdev, dmac);
1871-
ret = dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK);
1872-
if (ret)
1873-
return ret;
1871+
dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK);
18741872

18751873
ret = dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40));
18761874
if (ret)

drivers/dma/ste_dma40.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3632,11 +3632,7 @@ static int __init d40_probe(struct platform_device *pdev)
36323632
if (ret)
36333633
goto destroy_cache;
36343634

3635-
ret = dma_set_max_seg_size(base->dev, STEDMA40_MAX_SEG_SIZE);
3636-
if (ret) {
3637-
d40_err(dev, "Failed to set dma max seg size\n");
3638-
goto destroy_cache;
3639-
}
3635+
dma_set_max_seg_size(base->dev, STEDMA40_MAX_SEG_SIZE);
36403636

36413637
d40_hw_init(base);
36423638

drivers/gpu/drm/mediatek/mtk_drm_drv.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -559,11 +559,7 @@ static int mtk_drm_kms_init(struct drm_device *drm)
559559
* Configure the DMA segment size to make sure we get contiguous IOVA
560560
* when importing PRIME buffers.
561561
*/
562-
ret = dma_set_max_seg_size(dma_dev, UINT_MAX);
563-
if (ret) {
564-
dev_err(dma_dev, "Failed to set DMA segment size\n");
565-
goto err_component_unbind;
566-
}
562+
dma_set_max_seg_size(dma_dev, UINT_MAX);
567563

568564
ret = drm_vblank_init(drm, MAX_CRTC);
569565
if (ret < 0)

drivers/media/common/videobuf2/videobuf2-dma-contig.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,7 @@ int vb2_dma_contig_set_max_seg_size(struct device *dev, unsigned int size)
854854
return -ENODEV;
855855
}
856856
if (dma_get_max_seg_size(dev) < size)
857-
return dma_set_max_seg_size(dev, size);
858-
857+
dma_set_max_seg_size(dev, size);
859858
return 0;
860859
}
861860
EXPORT_SYMBOL_GPL(vb2_dma_contig_set_max_seg_size);

drivers/media/pci/intel/ipu6/ipu6.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,9 +576,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
576576
if (ret)
577577
return dev_err_probe(dev, ret, "Failed to set DMA mask\n");
578578

579-
ret = dma_set_max_seg_size(dev, UINT_MAX);
580-
if (ret)
581-
return dev_err_probe(dev, ret, "Failed to set max_seg_size\n");
579+
dma_set_max_seg_size(dev, UINT_MAX);
582580

583581
ret = ipu6_pci_config_setup(pdev, isp->hw_ver);
584582
if (ret)

drivers/mmc/host/mmci_stm32_sdmmc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ static int sdmmc_idma_setup(struct mmci_host *host)
213213
host->mmc->max_seg_size = host->mmc->max_req_size;
214214
}
215215

216-
return dma_set_max_seg_size(dev, host->mmc->max_seg_size);
216+
dma_set_max_seg_size(dev, host->mmc->max_seg_size);
217+
return 0;
217218
}
218219

219220
static int sdmmc_idma_start(struct mmci_host *host, unsigned int *datactrl)

0 commit comments

Comments
 (0)