Commit ad8529fd authored by Dave Gerlach's avatar Dave Gerlach Committed by Herbert Xu

hwrng: omap - Only fail if pm_runtime_get_sync returns < 0

Currently omap-rng checks the return value of pm_runtime_get_sync and
reports failure if anything is returned, however it should be checking
if ret < 0 as pm_runtime_get_sync return 0 on success but also can return
1 if the device was already active which is not a failure case. Only
values < 0 are actual failures.

Fixes: 61dc0a44 ("hwrng: omap - Fix assumption that runtime_get_sync will always succeed")
Signed-off-by: default avatarDave Gerlach <d-gerlach@ti.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 182e283f
...@@ -385,7 +385,7 @@ static int omap_rng_probe(struct platform_device *pdev) ...@@ -385,7 +385,7 @@ static int omap_rng_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
ret = pm_runtime_get_sync(&pdev->dev); ret = pm_runtime_get_sync(&pdev->dev);
if (ret) { if (ret < 0) {
dev_err(&pdev->dev, "Failed to runtime_get device: %d\n", ret); dev_err(&pdev->dev, "Failed to runtime_get device: %d\n", ret);
pm_runtime_put_noidle(&pdev->dev); pm_runtime_put_noidle(&pdev->dev);
goto err_ioremap; goto err_ioremap;
...@@ -443,7 +443,7 @@ static int __maybe_unused omap_rng_resume(struct device *dev) ...@@ -443,7 +443,7 @@ static int __maybe_unused omap_rng_resume(struct device *dev)
int ret; int ret;
ret = pm_runtime_get_sync(dev); ret = pm_runtime_get_sync(dev);
if (ret) { if (ret < 0) {
dev_err(dev, "Failed to runtime_get device: %d\n", ret); dev_err(dev, "Failed to runtime_get device: %d\n", ret);
pm_runtime_put_noidle(dev); pm_runtime_put_noidle(dev);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment