soundwire: cadence: Don't overwrite msg->buf during write commands
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Fri, 16 Sep 2022 10:35:05 +0000 (11:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:35:48 +0000 (12:35 +0200)
commit093a5463aeecc8a8d13bac233652cf6532d53dd7
tree60ac296ba47262eea2fd73bb89af9e61a41d813a
parent1b4ed920b2ffa6bfd94a04417c60996d6a802025
soundwire: cadence: Don't overwrite msg->buf during write commands

[ Upstream commit ba05b39d265bdd16913f7684600d9d41e2796745 ]

The buf passed in struct sdw_msg must only be written for a READ,
in that case the RDATA part of the response is the data value of the
register.

For a write command there is no RDATA, and buf should be assumed to
be const and unmodifable. The original caller should not expect its data
buffer to be corrupted by an sdw_nwrite().

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220916103505.1562210-1-rf@opensource.cirrus.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/soundwire/cadence_master.c