Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1588174 > unrolled thread

[PATCH 2/3] mmc: sdhci-acpi: Check device status before calling fix_up_power()

Started byHans de Goede <hdegoede@redhat.com>
First post2017-02-25 18:30 +0100
Last post2017-02-25 19:40 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/3] mmc: sdhci-acpi: Check device status before calling fix_up_power() Hans de Goede <hdegoede@redhat.com> - 2017-02-25 18:30 +0100
    Re: [PATCH 2/3] mmc: sdhci-acpi: Check device status before calling  fix_up_power() Hans de Goede <hdegoede@redhat.com> - 2017-02-25 19:40 +0100

#1588174 — [PATCH 2/3] mmc: sdhci-acpi: Check device status before calling fix_up_power()

FromHans de Goede <hdegoede@redhat.com>
Date2017-02-25 18:30 +0100
Subject[PATCH 2/3] mmc: sdhci-acpi: Check device status before calling fix_up_power()
Message-ID<teOkp-2Fm-7@gated-at.bofh.it>
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 <hdegoede@redhat.com>
---
 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;
 
-- 
2.9.3

[toc] | [next] | [standalone]


#1588192 — Re: [PATCH 2/3] mmc: sdhci-acpi: Check device status before calling fix_up_power()

FromHans de Goede <hdegoede@redhat.com>
Date2017-02-25 19:40 +0100
SubjectRe: [PATCH 2/3] mmc: sdhci-acpi: Check device status before calling fix_up_power()
Message-ID<tePqa-3qC-5@gated-at.bofh.it>
In reply to#1588174
HI,

On 25-02-17 18: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.

This paragraph of the commit msg should be removed, I dropped
that part of the patch since acpi_init_device_object() already sets
status and all acpi_device's get that called upon creation.

Regards,

Hans



>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  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;
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web