lkml.org 
[lkml]   [2014]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/5] dma-mapping: Add devm_ interface for dma_map_single()
Hello, Eli.

On Sat, May 17, 2014 at 03:19:21PM +0300, Eli Billauer wrote:
> >>+ if (dma_mapping_error(dev, dma_handle)) {
> >>+ devres_free(dr);
> >>+ return 0;
> >Can't we just keep returning dma_handle? Even if that means invoking
> >->mapping_error() twice? It's yucky to have subtly different error
> >return especially because in most cases it won't fail.
> Yucky it is indeed. There are however two problems with keeping the existing
> API:
>
> * What to do if devres_alloc() fails. How do I signal back an error? The
> only way I can think of is returning zero. But if the caller should know
> that zero means failure, I've already broken the API. I might as well return
> zero for any kind of failure.

What can't it just do the following?

if (dma_mapping_error(dev, dma_handle)) {
devres_free(dr);
return dma_handle;
}

The caller would have to invoke dma_mapping_error() again but is that
a problem?

Thanks.

--
tejun


\
 
 \ /
  Last update: 2014-05-20 06:41    [W:1.185 / U:1.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site