1
0
Fork 0
forked from len0rd/rockbox

Sansa Connect: Fix sending ZLP on non-zero endpoint

This fixes panic when mass storage driver sends failed result.

Change-Id: I14ae975b1f23aee7bc2f7bad6ed68dde29cf5e36
This commit is contained in:
Tomasz Moń 2021-06-09 16:07:42 +02:00
parent efa173a923
commit a11c88e0df
No known key found for this signature in database
GPG key ID: 92BA8820D4D517C8

View file

@ -590,10 +590,21 @@ static int tnetv_ep_start_xmit(int epn, void *buf, int size)
else
{
dma_addr_t buffer = (dma_addr_t)buf;
commit_discard_dcache_range(buf, size);
int send_zlp = 0;
if (size == 0)
{
/* Any address in SDRAM will do, contents do not matter */
buffer = CONFIG_SDRAM_START;
size = 1;
send_zlp = 1;
}
else
{
commit_discard_dcache_range(buf, size);
}
if ((buffer >= CONFIG_SDRAM_START) && (buffer + size < CONFIG_SDRAM_START + SDRAM_SIZE))
{
if (tnetv_cppi_send(&cppi, (epn - 1), buffer, size, 0))
if (tnetv_cppi_send(&cppi, (epn - 1), buffer, size, send_zlp))
{
panicf("tnetv_cppi_send() failed");
}