[PATCH 5.4 13/17] panic: Consolidate open-coded panic_on_warn checks