[PATCH v4 5.4 1/2] test_firmware: prevent race conditions by a correct implementation of locking