Factor out device list form error-clearing code