[PATCH 4.19 122/422] rtnetlink: move type calculation out of loop