Refactor the memory slot check logic to improve readability

Bug: 293811969
Test: TH
Change-Id: I77e91960e46aeb2c205d772e0f3e6129b97dd5b4
1 file changed