]> git.baikalelectronics.ru Git - kernel.git/commit
soundwire: cadence: Remove wasted space in response_buf
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Fri, 2 Dec 2022 16:18:11 +0000 (16:18 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 12:55:40 +0000 (13:55 +0100)
commit83310372b982f88f84f90490c1f5bb47b3519237
treee21ff274e23fb499936a1d88a7ea91b4fd9db2ef
parent95949d93613e46859323d35ceb57c44480b1eff9
soundwire: cadence: Remove wasted space in response_buf

[ Upstream commit c3b054e9bb1889e3f237065cb4735c3c964850dd ]

The response_buf was declared much larger (128 entries) than the number
of responses that could ever be written into it. The Cadence IP is
configurable up to a maximum of 32 entries, and the datasheet says
that RX_FIFO_AVAIL can be 2 larger than this. So allow up to 34
responses.

Also add checking in cdns_read_response() to prevent overflowing
reponse_buf if RX_FIFO_AVAIL contains an unexpectedly large number.

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/20221202161812.4186897-3-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
drivers/soundwire/cadence_master.h