Check device index is in bounds