Subject: Re: linux-next: build warnings after merge of the akpm-current tree

From: Andrew Morton <[email-masked]>
Date: Fri, 3 Oct 2014 11:21:54 -0700

On Fri, 3 Oct 2014 17:30:04 +1000 Stephen Rothwell <[email-masked]> wrote:

> Hi Andrew,
> 
> After merging the akpm-current tree, today's linux-next build (arm
> multi_v7_defconfig) produced these warnings:
> 
> drivers/base/dma-contiguous.c:244:2: warning: initialization from incompatible pointer type
>   .device_init = rmem_cma_device_init,
>   ^
> drivers/base/dma-contiguous.c:244:2: warning: (near initialization for 'rmem_cma_ops.device_init')
> drivers/base/dma-coherent.c:303:2: warning: initialization from incompatible pointer type
>   .device_init = rmem_dma_device_init,
>   ^
> 
> Introduced by commit e92f6296f3a2 ("drivers: dma-coherent: add
> initialization from device tree").  This init routine is supposed to
> return void ...

I'm a bit reluctant to just go in and change rmem_cma_device_init().

Why does it test for rmem->priv==NULL?  Can that really happen?  Why? 
Is it a legitimate state?

And why does dev_set_cma_area() test for dev==NULL?  Can that really
happen?  Is it legitimate?  Is all this stuff just papering over other
bugs?

The whole thing could do with a bit of an audit and cleanup, I suspect.
Get the states and initialization sequences and error checking all
sorted out, then get rid of all these tests for NULL.