[PATCH 4.9 006/118] stm class: Fix an endless loop in channel allocation