diff options
author | Mikko Perttunen <mperttunen@nvidia.com> | 2014-06-17 08:07:55 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-06-17 12:10:59 -0400 |
commit | acbd573354bb7b7b7a3891018a39f4b3976b0c43 (patch) | |
tree | 28587e0f81699a09a6a58cecbd726c591ff3caf9 /drivers/ata | |
parent | ebe06187bf2aec10d537ce4595e416035367d703 (diff) |
libahci_platform: Fail when PHY required but PHY support disabled
ahci_platform_get_resources handles resource management for
platform AHCI drivers, including getting a possible PHY
from the device tree. Since not all drivers need a PHY, it
ignores -ENODEV and -ENOSYS from devm_get_phy. However, when
the PHY subsystem is mistakenly disabled, -ENOSYS can be
returned even when a PHY is needed.
This patch modifies the -ENOSYS case to check if a "phys"
device tree node exists. If it exists, then clearly the PHY
subsystem is mistakenly disabled and the driver cannot work,
ahci_platform_get_resources will fail and propagate the error.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libahci_platform.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index 3a5b4ed25a4f..b0077589f065 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c | |||
@@ -250,8 +250,13 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev) | |||
250 | if (IS_ERR(hpriv->phy)) { | 250 | if (IS_ERR(hpriv->phy)) { |
251 | rc = PTR_ERR(hpriv->phy); | 251 | rc = PTR_ERR(hpriv->phy); |
252 | switch (rc) { | 252 | switch (rc) { |
253 | case -ENODEV: | ||
254 | case -ENOSYS: | 253 | case -ENOSYS: |
254 | /* No PHY support. Check if PHY is required. */ | ||
255 | if (of_find_property(dev->of_node, "phys", NULL)) { | ||
256 | dev_err(dev, "couldn't get sata-phy: ENOSYS\n"); | ||
257 | goto err_out; | ||
258 | } | ||
259 | case -ENODEV: | ||
255 | /* continue normally */ | 260 | /* continue normally */ |
256 | hpriv->phy = NULL; | 261 | hpriv->phy = NULL; |
257 | break; | 262 | break; |