aboutsummaryrefslogtreecommitdiff
path: root/drivers/soundwire
diff options
context:
space:
mode:
authorGravatar Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 2023-01-19 15:32:08 +0800
committerGravatar Vinod Koul <vkoul@kernel.org> 2023-01-31 19:57:17 +0530
commit5ec0c8721c06fc55d8a0bb32c403228358987eb6 (patch)
treeb0bf757a503ce8f3983861157b535eb87a061e32 /drivers/soundwire
parentsoundwire: bus: Remove unused reset_page_addr() callback (diff)
downloadlinux-5ec0c8721c06fc55d8a0bb32c403228358987eb6.tar.gz
linux-5ec0c8721c06fc55d8a0bb32c403228358987eb6.tar.bz2
linux-5ec0c8721c06fc55d8a0bb32c403228358987eb6.zip
soundwire: stream: use consistent pattern for freeing buffers
The code should free the message buffer used for data, the message structure used for control and assign the latter to NULL. The last part is missing for multi-link cases, and the order is inconsistent for single-link cases. Link: https://github.com/thesofproject/linux/issues/4056 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230119073211.85979-2-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/soundwire')
-rw-r--r--drivers/soundwire/stream.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index df3b36670df4..9c13dbd2b26e 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -723,8 +723,8 @@ static int sdw_bank_switch(struct sdw_bus *bus, int m_rt_count)
}
if (!multi_link) {
- kfree(wr_msg);
kfree(wbuf);
+ kfree(wr_msg);
bus->defer_msg.msg = NULL;
bus->params.curr_bank = !bus->params.curr_bank;
bus->params.next_bank = !bus->params.next_bank;
@@ -769,6 +769,7 @@ static int sdw_ml_sync_bank_switch(struct sdw_bus *bus)
if (bus->defer_msg.msg) {
kfree(bus->defer_msg.msg->buf);
kfree(bus->defer_msg.msg);
+ bus->defer_msg.msg = NULL;
}
return 0;
@@ -867,6 +868,7 @@ error:
if (bus->defer_msg.msg) {
kfree(bus->defer_msg.msg->buf);
kfree(bus->defer_msg.msg);
+ bus->defer_msg.msg = NULL;
}
}