From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751840AbdCCPEL (ORCPT ); Fri, 3 Mar 2017 10:04:11 -0500 Received: from mx2.suse.de ([195.135.220.15]:59514 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751310AbdCCPD5 (ORCPT ); Fri, 3 Mar 2017 10:03:57 -0500 Date: Fri, 3 Mar 2017 10:09:05 +0100 From: Jean Delvare To: Hans de Goede Cc: Adrian Hunter , Ulf Hansson , Jean Delvare , Takashi Iwai , russianneuromancer@ya.ru, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] mmc: sdhci-acpi: Check device status before calling fix_up_power() Message-ID: <20170303100905.090e0364@endymion> In-Reply-To: <20170225172357.26294-3-hdegoede@redhat.com> References: <20170225172357.26294-1-hdegoede@redhat.com> <20170225172357.26294-3-hdegoede@redhat.com> Organization: SUSE Linux X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.31; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hans, Adrian, On Sat, 25 Feb 2017 18:23:56 +0100, Hans de Goede wrote: > Calling acpi_device_fix_up_power() on a device which is not present > is not a good idea. How bad is it? This was introduced by commit e5bbf30733f9, which was backported to several stable branches. If it causes real trouble then this fix-up patch should be annotated with Fixes: e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are powered when") and Cc's to stable@, so it can be propagated to all affected trees. > 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 > --- > 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; > -- Jean Delvare SUSE L3 Support