Skip to content

Commit ad8529f

Browse files
dgerlachherbertx
authored andcommitted
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: 61dc0a4 ("hwrng: omap - Fix assumption that runtime_get_sync will always succeed") Signed-off-by: Dave Gerlach <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 182e283 commit ad8529f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/char/hw_random/omap-rng.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static int omap_rng_probe(struct platform_device *pdev)
385385

386386
pm_runtime_enable(&pdev->dev);
387387
ret = pm_runtime_get_sync(&pdev->dev);
388-
if (ret) {
388+
if (ret < 0) {
389389
dev_err(&pdev->dev, "Failed to runtime_get device: %d\n", ret);
390390
pm_runtime_put_noidle(&pdev->dev);
391391
goto err_ioremap;
@@ -443,7 +443,7 @@ static int __maybe_unused omap_rng_resume(struct device *dev)
443443
int ret;
444444

445445
ret = pm_runtime_get_sync(dev);
446-
if (ret) {
446+
if (ret < 0) {
447447
dev_err(dev, "Failed to runtime_get device: %d\n", ret);
448448
pm_runtime_put_noidle(dev);
449449
return ret;

0 commit comments

Comments
 (0)