From patchwork Sat Feb 25 17:23:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9591819 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D611A6042C for ; Sat, 25 Feb 2017 17:25:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C30142857F for ; Sat, 25 Feb 2017 17:25:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B569E28583; Sat, 25 Feb 2017 17:25:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A3CD2857F for ; Sat, 25 Feb 2017 17:25:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751889AbdBYRYO (ORCPT ); Sat, 25 Feb 2017 12:24:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58546 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751559AbdBYRYF (ORCPT ); Sat, 25 Feb 2017 12:24:05 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DFBE681F07; Sat, 25 Feb 2017 17:24:05 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-116-94.ams2.redhat.com [10.36.116.94]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1PHNxAP031937; Sat, 25 Feb 2017 12:24:04 -0500 From: Hans de Goede To: Adrian Hunter , Ulf Hansson , Jean Delvare Cc: Hans de Goede , Takashi Iwai , "russianneuromancer @ ya . ru" , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] mmc: sdhci-acpi: Check device status before calling fix_up_power() Date: Sat, 25 Feb 2017 18:23:56 +0100 Message-Id: <20170225172357.26294-3-hdegoede@redhat.com> In-Reply-To: <20170225172357.26294-1-hdegoede@redhat.com> References: <20170225172357.26294-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 25 Feb 2017 17:24:05 +0000 (UTC) Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;