[PATCH 6.1 003/166] test_firmware: prevent race conditions by a correct implementation of locking