Re: [PATCH 2/2] drivers: cpuidle: add driver/device checks in cpuidle_enter_freeze()

From: Lorenzo Pieralisi
Date: Wed Feb 25 2015 - 09:56:27 EST


On Wed, Feb 25, 2015 at 02:30:49PM +0000, Daniel Lezcano wrote:

[...]

> > diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> > index f47edc6c..344fe6c 100644
> > --- a/drivers/cpuidle/cpuidle.c
> > +++ b/drivers/cpuidle/cpuidle.c
> > @@ -44,6 +44,12 @@ void disable_cpuidle(void)
> > off = 1;
> > }
> >
> > +static bool cpuidle_device_disabled(struct cpuidle_driver *drv,
> > + struct cpuidle_device *dev)
> > +{
> > + return (off || !initialized || !drv || !dev || !dev->enabled);
> > +}
>
> This is getting a bit fuzzy IMO. What means disabled ? :)
>
> > /**
> > * cpuidle_play_dead - cpu off-lining
> > *
> > @@ -124,6 +130,11 @@ void cpuidle_enter_freeze(void)
> > struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
> > int index;
>
> I think this is exploding before because of dev == NULL in the line above.

Actually not, cpuidle_get_cpu_driver() checks the dev pointer, so
we might end up with drv == NULL and dev == NULL, and the check I added
still applies and it is effective I think.

Lorenzo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/