shadow: release device only if it is valid