dma: correct logic for setting the locked flag