Skip to content

Commit

Permalink
spi: img-spfi: Fix pm_runtime_get_sync() error checking
Browse files Browse the repository at this point in the history
If the device is already in a runtime PM enabled state
pm_runtime_get_sync() will return 1, so a test for negative
value should be used to check for errors.

Fixes: deba258 ("spi: Add driver for IMG SPFI controller")
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20220422062641.10486-1-zhengyongjun3@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Zheng Yongjun authored and broonie committed Apr 22, 2022
1 parent c2b5a40 commit cc470d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/spi/spi-img-spfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ static int img_spfi_resume(struct device *dev)
int ret;

ret = pm_runtime_get_sync(dev);
if (ret) {
if (ret < 0) {
pm_runtime_put_noidle(dev);
return ret;
}
Expand Down

0 comments on commit cc470d5

Please sign in to comment.