lkml.org 
[lkml]   [2018]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] remove the ->mapping_error method from dma_map_ops
On Fri, Nov 09, 2018 at 03:12:34PM -0800, David Miller wrote:
> But patch #2 on the other hand, not so much.
>
> I hate seeing values returned by reference, it adds cost especially
> on cpus where all argments and return values fit in registers (we end
> up forcing a stack slot and memory references).
>
> And we don't need it here.
>
> DMA addresses are like pointers, and therefore we can return errors and
> valid success values in the same dma_addr_t just fine. PTR_ERR() --> DMA_ERR(),
> IS_PTR_ERR() --> IS_DMA_ERR, etc.

In the end this is an inline function, so with a decently smart
compiler the generated code shouldn't change too much. The big problem
that prompted me to come up with this patch is that not handling failure
from dma_map* in a swiotlb setup can lead to grave data corruption, and
we have no easy way to force error checking on these return values.

I've added a few of the static typechecking suspect if they have a
better idea on how to make the return value of dma_map_single/pages
in a way that we get warnings if dma_mapping_error isn't called on them.
But I can't really think of a good way.

\
 
 \ /
  Last update: 2018-11-19 14:55    [W:0.244 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site