From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752873AbbBYO4W (ORCPT ); Wed, 25 Feb 2015 09:56:22 -0500 Received: from foss.arm.com ([217.140.101.70]:37795 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752516AbbBYO4U (ORCPT ); Wed, 25 Feb 2015 09:56:20 -0500 Date: Wed, 25 Feb 2015 14:56:46 +0000 From: Lorenzo Pieralisi To: Daniel Lezcano Cc: "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Rafael J. Wysocki" Subject: Re: [PATCH 2/2] drivers: cpuidle: add driver/device checks in cpuidle_enter_freeze() Message-ID: <20150225145646.GE20214@red-moon> References: <1424800730-32059-1-git-send-email-lorenzo.pieralisi@arm.com> <1424800730-32059-3-git-send-email-lorenzo.pieralisi@arm.com> <54EDDC99.40208@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54EDDC99.40208@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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