Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit afa0e52c authored by Laura Abbott's avatar Laura Abbott Committed by Ian Maund
Browse files

arm64: Warn on NULL device structure for dma APIs



Although parts of the DMA apis may properly check for NULL devices,
there may be some places that don't. Rather than fix up all the
possible locations, just require a non-NULL device structure to be
used for allocating/freeing.

Cc: Will Deacon <will.deacon@arm.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarLaura Abbott <lauraa@codeaurora.org>
[catalin.marinas@arm.com: s/WARN/WARN_ONCE/]
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Git-commit: c666e8d5cae745b1515898f8b7a033c468a899d0
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


[imaund@codeaurora.org: Maintain Catalin's substitution]
Signed-off-by: default avatarIan Maund <imaund@codeaurora.org>
parent db6d27a8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ static void *arm64_swiotlb_alloc_coherent(struct device *dev, size_t size,
					  struct dma_attrs *attrs)
{
	if (dev == NULL) {
		WARN(1, "Use an actual device structure for DMA allocation\n");
		WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
		return NULL;
	}

@@ -63,7 +63,7 @@ static void arm64_swiotlb_free_coherent(struct device *dev, size_t size,
					struct dma_attrs *attrs)
{
	if (dev == NULL) {
		WARN(1, "Use an actual device structure for DMA allocation\n");
		WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
		return;
	}