[PATCH] drm/gem-cma-helper: Change the level of the allocation failure message

Eric Engestrom eric.engestrom at imgtec.com
Thu Oct 5 09:13:59 UTC 2017


On Thursday, 2017-10-05 10:57:47 +0200, Boris Brezillon wrote:
> On Thu, 5 Oct 2017 09:48:24 +0100
> Eric Engestrom <eric.engestrom at imgtec.com> wrote:
> 
> > On Wednesday, 2017-10-04 22:28:54 +0000, Eric Anholt wrote:
> > > Boris Brezillon <boris.brezillon at free-electrons.com> writes:
> > >   
> > > > drm_gem_cma_create() prints an error message when dma_alloc_wc() fails to
> > > > allocate the amount of memory we requested. This can lead to annoying
> > > > error messages when CMA is only one possible source of memory for the BO
> > > > allocation.
> > > >
> > > > Turn this error message into a debug one and add a __must_check specifier
> > > > to make sure all callers are checking the return value.
> > > >
> > > > Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>  
> > > 
> > > The __must_check seems unnecessary to me -- you're definitely going to
> > > be doing something with the return value, because otherwise why did you
> > > call the object allocate function?  
> > 
> > Indeed, `__must_check` (aka `warn_unused_result`) only makes sure the
> > return value is not discarded, which will probably always be true here.
> 
> I agree, this __must_check is not really useful here.
> 
> > 
> > > The `warn_unused_result` attribute causes a warning to be emitted if
> > > a caller of the function with this attribute does not use its return
> > > value.  
> > 
> > I think we need a sparse attribute to check that the return value is
> > IS_ERR()-checked?
> 
> Can we just turn the dev_err() into dev_dbg() for now? The 'force
> callers to check IS_ERR()' is kind of orthogonal to the change I'm
> doing here.

Definitely, the function you're touching just happens to be a user of
this potential new attribute.

IMO just drop the header part of the change, and this is
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

On the sparse attribute discussion, anyone knows someone with experience
doing that?


More information about the dri-devel mailing list