[PATCH 5.4 126/134] panic: Consolidate open-coded panic_on_warn checks