Skip to content

Commit 1a71f0f

Browse files
committed
SDIO: Remove file "good" checks so errors are properly produced.
1 parent f1f8b0a commit 1a71f0f

File tree

1 file changed

+26
-32
lines changed

1 file changed

+26
-32
lines changed

Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -284,24 +284,21 @@ s32 SDIOSlot0Device::ExecuteCommand(const Request& request, u32 buffer_in, u32 b
284284
INFO_LOG_FMT(IOS_SD, "{}Read {} Block(s) from {:#010x} bsize {} into {:#010x}!",
285285
req.isDMA ? "DMA " : "", req.blocks, req.arg, req.bsize, req.addr);
286286

287-
if (m_card)
288-
{
289-
const u32 size = req.bsize * req.blocks;
290-
const u64 address = GetAddressFromRequest(req.arg);
287+
const u32 size = req.bsize * req.blocks;
288+
const u64 address = GetAddressFromRequest(req.arg);
291289

292-
if (!m_card.Seek(address, File::SeekOrigin::Begin))
293-
ERROR_LOG_FMT(IOS_SD, "Seek failed");
290+
if (!m_card.Seek(address, File::SeekOrigin::Begin))
291+
ERROR_LOG_FMT(IOS_SD, "Seek failed");
294292

295-
if (m_card.ReadBytes(memory.GetPointerForRange(req.addr, size), size))
296-
{
297-
DEBUG_LOG_FMT(IOS_SD, "Outbuffer size {} got {}", rw_buffer_size, size);
298-
}
299-
else
300-
{
301-
ERROR_LOG_FMT(IOS_SD, "Read Failed - error: {}, eof: {}", std::ferror(m_card.GetHandle()),
302-
std::feof(m_card.GetHandle()));
303-
ret = RET_FAIL;
304-
}
293+
if (m_card.ReadBytes(memory.GetPointerForRange(req.addr, size), size))
294+
{
295+
DEBUG_LOG_FMT(IOS_SD, "Outbuffer size {} got {}", rw_buffer_size, size);
296+
}
297+
else
298+
{
299+
ERROR_LOG_FMT(IOS_SD, "Read Failed - error: {}, eof: {}", std::ferror(m_card.GetHandle()),
300+
std::feof(m_card.GetHandle()));
301+
ret = RET_FAIL;
305302
}
306303
}
307304
memory.Write_U32(0x900, buffer_out);
@@ -319,7 +316,7 @@ s32 SDIOSlot0Device::ExecuteCommand(const Request& request, u32 buffer_in, u32 b
319316
ERROR_LOG_FMT(IOS_SD, "Write attempted while locked.");
320317
ret = RET_LOCKED;
321318
}
322-
else if (m_card)
319+
else
323320
{
324321
const u32 size = req.bsize * req.blocks;
325322
const u64 address = GetAddressFromRequest(req.arg);
@@ -475,24 +472,21 @@ std::optional<IPCReply> SDIOSlot0Device::SendCommand(const IOCtlRequest& request
475472
IPCReply SDIOSlot0Device::GetStatus(const IOCtlRequest& request)
476473
{
477474
// Since IOS does the SD initialization itself, we just say we're always initialized.
478-
if (m_card)
475+
if (m_card.GetSize() <= SDSC_MAX_SIZE)
479476
{
480-
if (m_card.GetSize() <= SDSC_MAX_SIZE)
481-
{
482-
// No further initialization required.
483-
m_status |= CARD_INITIALIZED;
484-
}
485-
else
477+
// No further initialization required.
478+
m_status |= CARD_INITIALIZED;
479+
}
480+
else
481+
{
482+
// Some IOS versions support SDHC.
483+
// Others will work if they are manually initialized (SEND_IF_COND)
484+
if (m_sdhc_supported)
486485
{
487-
// Some IOS versions support SDHC.
488-
// Others will work if they are manually initialized (SEND_IF_COND)
489-
if (m_sdhc_supported)
490-
{
491-
// All of the initialization is done internally by IOS, so we get to skip some steps.
492-
InitSDHC();
493-
}
494-
m_status |= CARD_SDHC;
486+
// All of the initialization is done internally by IOS, so we get to skip some steps.
487+
InitSDHC();
495488
}
489+
m_status |= CARD_SDHC;
496490
}
497491

498492
// Evaluate whether a card is currently inserted (config value).

0 commit comments

Comments
 (0)