spi: stm32: fix pm_runtime_get_sync() error checking
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 9 Sep 2020 09:43:04 +0000 (12:43 +0300)
committerMark Brown <broonie@kernel.org>
Wed, 9 Sep 2020 14:11:44 +0000 (15:11 +0100)
The pm_runtime_get_sync() can return either 0 or 1 on success but this
code treats 1 as a failure.

Fixes: db96bf976a4f ("spi: stm32: fixes suspend/resume management")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Alain Volmat <alain.volmat@st.com>
Link: https://lore.kernel.org/r/20200909094304.GA420136@mwanda
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-stm32.c

index a00f6b5..3056428 100644 (file)
@@ -2064,7 +2064,7 @@ static int stm32_spi_resume(struct device *dev)
        }
 
        ret = pm_runtime_get_sync(dev);
-       if (ret) {
+       if (ret < 0) {
                dev_err(dev, "Unable to power device:%d\n", ret);
                return ret;
        }