h8300: Fix coverity issues, fix tests.