NXP-10974: cleanup code thanks to sonar