summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2024-03-24 03:42:53 +0100
committerChristian Soffke <christian.soffke@gmail.com>2024-03-24 13:22:09 -0400
commit53e7176196b897d9924a4bbc8f8994fa2888ab0e (patch)
treea0cad77fcda6fad6ec27bf2efa4cae67586299a9
parent34361c82f15a2f11f1737dc5ee30f650e93079c3 (diff)
downloadrockbox-53e7176196b897d9924a4bbc8f8994fa2888ab0e.tar.gz
rockbox-53e7176196b897d9924a4bbc8f8994fa2888ab0e.zip
dircache: don't unpin invalid buflib handle when building volumes
Buflib pinning was introduced here in 1718cf5. If the device has to immediately shut down after booting because of a low battery, the directory cache may be disabled by the time core_unpin() is reached. Its handle will have been reset to 0 in that case, triggering a panic message due to an invalid buflib handle. Change-Id: Ie34c3f7142d8406b66277ef185bc9ecf387d7295
-rw-r--r--firmware/common/dircache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
index 41564194d0..c274b6c62c 100644
--- a/firmware/common/dircache.c
+++ b/firmware/common/dircache.c
@@ -1882,7 +1882,8 @@ static void build_volumes(void)
1882 1882
1883 logf("Done, %ld KiB used", dircache.size / 1024); 1883 logf("Done, %ld KiB used", dircache.size / 1024);
1884 1884
1885 core_unpin(dircache_runinfo.handle); 1885 if (dircache_runinfo.handle > 0) /* dircache may have been disabled */
1886 core_unpin(dircache_runinfo.handle);
1886} 1887}
1887 1888
1888/** 1889/**