]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: rt5682: Fix a problem with error handling in the io init function of the soundwire
authorOder Chiou <oder_chiou@realtek.com>
Mon, 7 Jun 2021 22:22:36 +0000 (17:22 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 15:00:19 +0000 (17:00 +0200)
[ Upstream commit 9266d95405ae0c078f188ec8bca3a004631be429 ]

The device checking error should be a jump to pm_runtime_put_autosuspend()
as done before returning value.

Fixes: 867f8d18df4f ('ASoC: rt5682: fix getting the wrong device id when the suspend_stress_test')
Reviewed-by: Bard Liao <bard.liao@intel.com>
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210607222239.582139-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/codecs/rt5682-sdw.c

index 6bf1b4c31296e8aab6e3940d81b2a001e20a0bfb..2b0f02e6c977dd9f6fea397c240eb3b955011b1c 100644 (file)
@@ -408,9 +408,11 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave)
                usleep_range(30000, 30005);
                loop--;
        }
+
        if (val != DEVICE_ID) {
                dev_err(dev, "Device with ID register %x is not rt5682\n", val);
-               return -ENODEV;
+               ret = -ENODEV;
+               goto err_nodev;
        }
 
        if (rt5682->first_hw_init) {
@@ -486,10 +488,11 @@ reinit:
        rt5682->hw_init = true;
        rt5682->first_hw_init = true;
 
+err_nodev:
        pm_runtime_mark_last_busy(&slave->dev);
        pm_runtime_put_autosuspend(&slave->dev);
 
-       dev_dbg(&slave->dev, "%s hw_init complete\n", __func__);
+       dev_dbg(&slave->dev, "%s hw_init complete: %d\n", __func__, ret);
 
        return ret;
 }