lkml.org 
[lkml]   [2010]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] OMAP: Dereference of NULL autodep in _autodep_lookup()
    Don't dereference autodep when it's NULL. In _autodep_lookup() an
    ERR_PTR(-ENOENT) is assigned to autodep->pwrdm.ptr if pwrdm_lookup() fails.

    Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
    ---

    Alternatively we could do:

    - for (autodep = autodeps; autodep->pwrdm.ptr; autodep++)
    + for (autodep = autodeps; !IS_ERR(autodep->pwrdm.ptr); autodep++)

    ...but considering how _clkdm_add_autodeps() traverses trough the autodeps it
    appears that we want to ignore failures. Correct?

    Roel

    diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
    index dd285f0..8f359c1 100644
    --- a/arch/arm/mach-omap2/clockdomain.c
    +++ b/arch/arm/mach-omap2/clockdomain.c
    @@ -64,9 +64,6 @@ static void _autodep_lookup(struct clkdm_pwrdm_autodep *autodep)
    {
    struct powerdomain *pwrdm;

    - if (!autodep)
    - return;
    -
    if (!omap_chip_is(autodep->omap_chip))
    return;

    @@ -211,7 +208,7 @@ void clkdm_init(struct clockdomain **clkdms,

    autodeps = init_autodeps;
    if (autodeps)
    - for (autodep = autodeps; autodep->pwrdm.ptr; autodep++)
    + for (autodep = autodeps; autodep; autodep++)
    _autodep_lookup(autodep);
    }


    \
     
     \ /
      Last update: 2010-02-14 16:55    [W:0.020 / U:33.332 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site