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


Groups > linux.kernel > #1487433 > unrolled thread

[PATCH] hwrng: omap - Only fail if pm_runtime_get_sync returns < 0

Started byDave Gerlach <d-gerlach@ti.com>
First post2016-09-20 17:30 +0200
Last post2016-09-22 13:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] hwrng: omap - Only fail if pm_runtime_get_sync returns < 0 Dave Gerlach <d-gerlach@ti.com> - 2016-09-20 17:30 +0200
    Re: [PATCH] hwrng: omap - Only fail if pm_runtime_get_sync returns <  0 Herbert Xu <herbert@gondor.apana.org.au> - 2016-09-22 13:10 +0200

#1487433 — [PATCH] hwrng: omap - Only fail if pm_runtime_get_sync returns < 0

FromDave Gerlach <d-gerlach@ti.com>
Date2016-09-20 17:30 +0200
Subject[PATCH] hwrng: omap - Only fail if pm_runtime_get_sync returns < 0
Message-ID<sjv9D-4MD-11@gated-at.bofh.it>
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: 61dc0a446e5d ("hwrng: omap - Fix assumption that runtime_get_sync will always succeed")
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
---
 drivers/char/hw_random/omap-rng.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index 01d4be2c354b..f5c26a5f6875 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -385,7 +385,7 @@ static int omap_rng_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(&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);
 		pm_runtime_put_noidle(&pdev->dev);
 		goto err_ioremap;
@@ -443,7 +443,7 @@ static int __maybe_unused omap_rng_resume(struct device *dev)
 	int ret;
 
 	ret = pm_runtime_get_sync(dev);
-	if (ret) {
+	if (ret < 0) {
 		dev_err(dev, "Failed to runtime_get device: %d\n", ret);
 		pm_runtime_put_noidle(dev);
 		return ret;
-- 
2.9.3

[toc] | [next] | [standalone]


#1488778 — Re: [PATCH] hwrng: omap - Only fail if pm_runtime_get_sync returns < 0

FromHerbert Xu <herbert@gondor.apana.org.au>
Date2016-09-22 13:10 +0200
SubjectRe: [PATCH] hwrng: omap - Only fail if pm_runtime_get_sync returns < 0
Message-ID<ska39-5ym-73@gated-at.bofh.it>
In reply to#1487433
On Tue, Sep 20, 2016 at 10:25:40AM -0500, Dave Gerlach wrote:
> 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: 61dc0a446e5d ("hwrng: omap - Fix assumption that runtime_get_sync will always succeed")
> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web