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)
committerVinod Koul <vkoul@kernel.org>
Tue, 20 Sep 2022 05:00:47 +0000 (10:30 +0530)
commitba05b39d265bdd16913f7684600d9d41e2796745
tree85f8a4ddc083cdecddae4760146c6939e033a06b
parent72124f07f0fab446caeea1f545d8c58b7549a899
soundwire: cadence: Don't overwrite msg->buf during write commands

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>
drivers/soundwire/cadence_master.c