hal: Add NULL checks and fix data initialization errors.

Add proper checks to fix NULL pointer dereference issues and
fix data initialization errors.

Change-Id: I2fbcbc209728b0b3f4774e943518a0883cd7e2be
1 file changed