hal: Fixes for the issues reported by KlocWork

-Fixes for KW issues reported which may cause NULL dereference:
283559, 293531, 293533, 309145

Change-Id: Ic0a1e891ba7a013ed48f1e5c82d4051f8e8b5a9d
3 files changed