meta-backend: Fix build
meta-backend: Fix the max device calculation on removal

If we add device 2, then add device 254, then remove device 254, then
the max device ID will be 253. Scan through all the devices again on
removal to calculate a new max device ID.