Commit 9266d954 authored by Oder Chiou's avatar Oder Chiou Committed by Mark Brown

ASoC: rt5682: Fix a problem with error handling in the io init function of the soundwire

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

Fixes: 867f8d18 ('ASoC: rt5682: fix getting the wrong device id when the suspend_stress_test')
Reviewed-by: default avatarBard Liao <bard.liao@intel.com>
Signed-off-by: default avatarOder Chiou <oder_chiou@realtek.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210607222239.582139-13-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent e343d34a
...@@ -408,9 +408,11 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave) ...@@ -408,9 +408,11 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave)
usleep_range(30000, 30005); usleep_range(30000, 30005);
loop--; loop--;
} }
if (val != DEVICE_ID) { if (val != DEVICE_ID) {
dev_err(dev, "Device with ID register %x is not rt5682\n", val); 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) { if (rt5682->first_hw_init) {
...@@ -486,10 +488,11 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave) ...@@ -486,10 +488,11 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave)
rt5682->hw_init = true; rt5682->hw_init = true;
rt5682->first_hw_init = true; rt5682->first_hw_init = true;
err_nodev:
pm_runtime_mark_last_busy(&slave->dev); pm_runtime_mark_last_busy(&slave->dev);
pm_runtime_put_autosuspend(&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; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment