Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753660Ab3FYSrV (ORCPT ); Tue, 25 Jun 2013 14:47:21 -0400 Received: from mga03.intel.com ([143.182.124.21]:43549 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753634Ab3FYSrS (ORCPT ); Tue, 25 Jun 2013 14:47:18 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,938,1363158000"; d="scan'208";a="260027999" Date: Tue, 25 Jun 2013 21:51:11 +0300 From: Mika Westerberg To: Andy Shevchenko Cc: Greg Kroah-Hartman , Bjorn Helgaas , "Rafael J. Wysocki" , Jesse Barnes , Yinghai Lu , john.ronciak@intel.com, miles.j.penner@intel.com, bruce.w.allan@intel.com, "Kirill A. Shutemov" , Heikki Krogerus , "linux-kernel@vger.kernel.org" , linux-pci@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 5/6] PCI: acpiphp: look _RMV method a bit deeper in the hierarhcy Message-ID: <20130625185111.GL9294@intel.com> References: <1372177330-28013-1-git-send-email-mika.westerberg@linux.intel.com> <1372177330-28013-6-git-send-email-mika.westerberg@linux.intel.com> <20130625183123.GJ9294@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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 Content-Length: 2096 Lines: 56 On Tue, Jun 25, 2013 at 09:31:52PM +0300, Andy Shevchenko wrote: > On Tue, Jun 25, 2013 at 9:31 PM, Mika Westerberg > wrote: > > On Tue, Jun 25, 2013 at 09:15:47PM +0300, Andy Shevchenko wrote: > >> On Tue, Jun 25, 2013 at 7:22 PM, Mika Westerberg > >> wrote: > > [] > > >> > +static acpi_status pcihp_evaluate_rmv(acpi_handle handle, u32 lvl, > >> > + void *context, void **return_not_used) > >> > +{ > >> > + unsigned long long *removable = context; > >> > + unsigned long long value; > >> > + acpi_status status; > >> > + > >> > + status = acpi_evaluate_integer(handle, "_RMV", NULL, &value); > >> > + if (ACPI_SUCCESS(status) && value) { > >> > >> So, there is a chance the caller gets back uninitialized *context. > >> Let's assume that is by design. > >> > >> > + *removable = value; > >> > + return AE_CTRL_TERMINATE; > >> > + } > >> > + return AE_OK; > >> > +} > >> > >> > >> > +static bool pcihp_is_removable(acpi_handle handle, size_t depth) > >> > +{ > >> > + unsigned long long removable = 0; > >> > + acpi_status status; > >> > + > >> > + status = pcihp_evaluate_rmv(handle, 0, &removable, NULL); > >> > + if ((status == AE_CTRL_TERMINATE) && removable) > >> > >> Here you already have removable not equal zero. > > > > Hmm, removable is initialized to zero just few lines above... Did I miss > > something obvious? > > Yes, that's correct, however, you already did this check when you call > evaluate_rmv. Thus, second check '&& removable' is not needed. Ah, right. Got it now :-) I think it is better to remove the first value check from the pcihp_evaluate_rmv() and keep the check here. I'll fix that in the next revision as well. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/