From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752360AbdCBMkf (ORCPT ); Thu, 2 Mar 2017 07:40:35 -0500 Received: from mga14.intel.com ([192.55.52.115]:53691 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751600AbdCBMkb (ORCPT ); Thu, 2 Mar 2017 07:40:31 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,231,1484035200"; d="scan'208";a="939786715" Subject: Re: [PATCH 2/3] mmc: sdhci-acpi: Check device status before calling fix_up_power() To: Hans de Goede , Ulf Hansson , Jean Delvare References: <20170225172357.26294-1-hdegoede@redhat.com> <20170225172357.26294-3-hdegoede@redhat.com> Cc: Takashi Iwai , "russianneuromancer @ ya . ru" , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <4481f84f-22a6-4ee6-9875-d5e03729b6fd@intel.com> Date: Thu, 2 Mar 2017 13:53:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170225172357.26294-3-hdegoede@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/02/17 19:23, Hans de Goede wrote: > Calling acpi_device_fix_up_power() on a device which is not present > is not a good idea. > > While at it also call acpi_bus_get_status() on the children before > the status check to make sure that child->status contains valid data. > > Signed-off-by: Hans de Goede Acked-by: Adrian Hunter > --- > drivers/mmc/host/sdhci-acpi.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c > index 96465ff..873beae 100644 > --- a/drivers/mmc/host/sdhci-acpi.c > +++ b/drivers/mmc/host/sdhci-acpi.c > @@ -394,15 +394,15 @@ static int sdhci_acpi_probe(struct platform_device *pdev) > if (acpi_bus_get_device(handle, &device)) > return -ENODEV; > > + if (acpi_bus_get_status(device) || !device->status.present) > + return -ENODEV; > + > /* Power on the SDHCI controller and its children */ > acpi_device_fix_up_power(device); > list_for_each_entry(child, &device->children, node) > if (child->status.present && child->status.enabled) > acpi_device_fix_up_power(child); > > - if (acpi_bus_get_status(device) || !device->status.present) > - return -ENODEV; > - > if (sdhci_acpi_byt_defer(dev)) > return -EPROBE_DEFER; > >