[PATCH 4/7] ARM: mx25: Retrieve IIM base from dt

Fabio Estevam festevam at gmail.com
Wed Mar 11 07:20:01 PDT 2015


On Wed, Mar 11, 2015 at 10:24 AM, Russell King - ARM Linux
<linux at arm.linux.org.uk> wrote:
> On Wed, Mar 11, 2015 at 09:43:52AM -0300, Fabio Estevam wrote:
>> +     void __iomem *iim_base;
>> +     struct device_node *np;
>> +
>> +     np = of_find_compatible_node(NULL, NULL, "fsl,imx25-iim");
>> +     iim_base = of_iomap(np, 0);
>> +     WARN_ON(!iim_base);
>> +     rev = readl(iim_base + MXC_IIMSREV);
>> +     iounmap(iim_base);
>
> Is there much point to that WARN_ON()?  Are you avoiding the political
> BUG_ON(!iim_base) ? :)
>
> Since a NULL pointer there will lead to a NULL pointer dereference, it's
> silly to use WARN_ON() there - we'll get a backtrace etc from the WARN_ON
> followed immediately by an oops dump due to the readl(), crashing the
> kernel.
>
> Better to just use BUG_ON() and only get one set of diagnostics.

Thanks, will do it in v2.



More information about the linux-arm-kernel mailing list