Commit 6fedae3c authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jens Axboe
Browse files

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: 2b2c47d9 ("ata: ahci_brcm: Allow optional reset controller to be used")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent ed87ad19
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -352,7 +352,6 @@ static int brcm_ahci_suspend(struct device *dev)
	else
		ret = 0;

	if (!IS_ERR_OR_NULL(priv->rcdev))
	reset_control_assert(priv->rcdev);

	return ret;
@@ -365,7 +364,6 @@ 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);
	if (ret)
		return ret;
@@ -454,8 +452,10 @@ 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))
	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);
@@ -520,7 +520,6 @@ 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);
	return ret;
}