chore(greptile): iteration 3 — applied 1, rejected 0

SDArchiveFileSystem.h: guard release_bus() in FileImpl::close() on
the acquire_bus return value, matching the pattern every other
method already uses. Previously close() (which is also called from
~FileImpl) issued an unconditional xSemaphoreGive even when
acquire_bus(500) timed out, skewing the SPI bus mutex counter on
each over-release.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
torlando-agent[bot]
2026-05-11 01:20:33 -04:00
co-authored by Claude Opus 4.7
parent a88983aa05
commit ec19df9d5e
@@ -47,9 +47,13 @@ public:
inline virtual size_t size() const { return _file.size(); }
inline virtual void close() {
if (!_open) return;
SDAccess::acquire_bus(500);
// Only release the bus if we actually took it — otherwise the
// matching xSemaphoreGive in release_bus() would be unmatched
// and skew the mutex counter. _file.close() under SPI contention
// is the lesser evil vs corrupting the bus mutex.
bool held = SDAccess::acquire_bus(500);
_file.close();
SDAccess::release_bus();
if (held) SDAccess::release_bus();
_open = false;
}
inline virtual int read() {