summaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2020-01-07 23:15:00 +0100
committerJens Axboe <axboe@kernel.dk>2020-01-17 05:49:09 +0100
commit6fedae3cad8b122c8b0afb26a0569d9910255edd (patch)
tree86b2dd526ec09a8c36d545495946588922b62af2 /drivers/ata
parentata: brcm: mark PM functions as __maybe_unused (diff)
downloadlinux-6fedae3cad8b122c8b0afb26a0569d9910255edd.tar.xz
linux-6fedae3cad8b122c8b0afb26a0569d9910255edd.zip
ata: brcm: fix reset controller API usage
While fixing another issue in this driver I noticed it uses IS_ERR_OR_NULL(), which is almost always a mistake. Change the driver to use the proper devm_reset_control_get_optional() interface instead and remove the checks except for the one that checks for a failure in that function. Fixes: 2b2c47d9e1fe ("ata: ahci_brcm: Allow optional reset controller to be used") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci_brcm.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c
index 239333d11b88..7ac1141c6ad0 100644
--- a/drivers/ata/ahci_brcm.c
+++ b/drivers/ata/ahci_brcm.c
@@ -352,8 +352,7 @@ static int brcm_ahci_suspend(struct device *dev)
else
ret = 0;
- if (!IS_ERR_OR_NULL(priv->rcdev))
- reset_control_assert(priv->rcdev);
+ reset_control_assert(priv->rcdev);
return ret;
}
@@ -365,8 +364,7 @@ static int __maybe_unused brcm_ahci_resume(struct device *dev)
struct brcm_ahci_priv *priv = hpriv->plat_data;
int ret = 0;
- if (!IS_ERR_OR_NULL(priv->rcdev))
- ret = reset_control_deassert(priv->rcdev);
+ ret = reset_control_deassert(priv->rcdev);
if (ret)
return ret;
@@ -454,9 +452,11 @@ static int brcm_ahci_probe(struct platform_device *pdev)
else
reset_name = "ahci";
- priv->rcdev = devm_reset_control_get(&pdev->dev, reset_name);
- if (!IS_ERR_OR_NULL(priv->rcdev))
- reset_control_deassert(priv->rcdev);
+ priv->rcdev = devm_reset_control_get_optional(&pdev->dev, reset_name);
+ if (IS_ERR(priv->rcdev))
+ return PTR_ERR(priv->rcdev);
+
+ reset_control_deassert(priv->rcdev);
hpriv = ahci_platform_get_resources(pdev, 0);
if (IS_ERR(hpriv)) {
@@ -520,8 +520,7 @@ out_disable_phys:
out_disable_clks:
ahci_platform_disable_clks(hpriv);
out_reset:
- if (!IS_ERR_OR_NULL(priv->rcdev))
- reset_control_assert(priv->rcdev);
+ reset_control_assert(priv->rcdev);
return ret;
}