dm: core: Add a function to find the first inactive child