hal: fix null pointer references and data initialization errors

 - add null pointer check and initialize uninitialized variables

CRs-Fixed: 2312146
Change-Id: I5f260b327492e1373ed143dd8dcf243154fd7818
5 files changed