Using pm_runtime_resume_and_get is more appropriate for simplifing code Signed-off-by: Zhang Qilong <zhangqilong3@xxxxxxxxxx> --- drivers/ata/sata_rcar.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c index 44b0ed8f6bb8..0934870388de 100644 --- a/drivers/ata/sata_rcar.c +++ b/drivers/ata/sata_rcar.c @@ -989,11 +989,9 @@ static int sata_rcar_resume(struct device *dev) void __iomem *base = priv->base; int ret; - ret = pm_runtime_get_sync(dev); - if (ret < 0) { - pm_runtime_put(dev); + ret = pm_runtime_resume_and_get(dev); + if (ret < 0) return ret; - } if (priv->type == RCAR_GEN3_SATA) { sata_rcar_init_module(priv); @@ -1017,11 +1015,9 @@ static int sata_rcar_restore(struct device *dev) struct ata_host *host = dev_get_drvdata(dev); int ret; - ret = pm_runtime_get_sync(dev); - if (ret < 0) { - pm_runtime_put(dev); + ret = pm_runtime_resume_and_get(dev); + if (ret < 0) return ret; - } sata_rcar_setup_port(host); -- 2.17.1