]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/sd/ssi-sd: Return noise (dummy byte) when no card connected
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Fri, 8 Aug 2025 12:57:44 +0000 (14:57 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Wed, 13 Aug 2025 06:15:33 +0000 (09:15 +0300)
commitc01efd93cf243c88abbd06c05e2217a1c4019124
tree799a79a1f51d99d570ae1f9431892868ade09026
parent64e5f0f93db1ceb142e949041af157fc7d563dbb
hw/sd/ssi-sd: Return noise (dummy byte) when no card connected

Commit 1585ab9f1ba ("hw/sd/sdcard: Fill SPI response bits in card
code") exposed a bug in the SPI adapter: if no SD card is plugged,
we are returning "there is a card with an error". This is wrong,
we shouldn't return any particular packet response, but the noise
shifted on the MISO line. Return the dummy byte, otherwise we get:

  qemu-system-riscv64: ../hw/sd/ssi-sd.c:160: ssi_sd_transfer: Assertion `s->arglen > 0' failed.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Fixes: 775616c3ae8 ("Partial SD card SPI mode support")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Gustavo Romero <gustavo.romero@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20250812140415.70153-2-philmd@linaro.org>
(cherry picked from commit e262646e12acd6c1132e03d57fea20680a503251)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/sd/ssi-sd.c