Merge "primary-hal: Fix issues found in static analysis"