hal: fix null pointer references and data initialization errors

  - add null pointer check and initialize uninitialized variables

CRs-Fixed: 2075786
Change-Id: I3e983673f36005be795a0d3adb3c54b5dcf0f002
3 files changed