[PATCH V3] [POWERPC] Add common clock setting routine mpc52xx_psc_set_clkdiv()

Grant Likely grant.likely at secretlab.ca
Fri Jan 11 02:01:09 EST 2008


On 1/10/08, Stephen Rothwell <sfr at canb.auug.org.au> wrote:
> Hi Grant,
>
> On Wed, 09 Jan 2008 22:26:30 -0700 Grant Likely <grant.likely at secretlab.ca> wrote:
> >
> > +mpc52xx_map_common_devices(void)
> >  {
>
> > +     /* Clock Distribution Module, used by PSC clock setting function */
> > +     np = of_find_matching_node(NULL, mpc52xx_cdm_ids);
>
> What happens if we find no node?

Both of_iomap and of_put fail gracefully if np is NULL.  IIRC that was
done on purpose so this exact thing could be done.

Users of mpc52xx_cdm (and the others done in this style) all check for
mpc52xx_cdm being NULL before dereferencing.

>
> > +     mpc52xx_cdm = of_iomap(np, 0);
> > +     of_node_put(np);
> >  }
>
> --
> Cheers,
> Stephen Rothwell                    sfr at canb.auug.org.au
> http://www.canb.auug.org.au/~sfr/
>
>


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.



More information about the Linuxppc-dev mailing list