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
diff --git a/hal/msm8916/hw_info.c b/hal/msm8916/hw_info.c
index ce508c1..689e834 100644
--- a/hal/msm8916/hw_info.c
+++ b/hal/msm8916/hw_info.c
@@ -226,6 +226,10 @@
     struct hardware_info *hw_info;
 
     hw_info = malloc(sizeof(struct hardware_info));
+    if (!hw_info) {
+        ALOGE("failed to allocate mem for hardware info");
+        return NULL;
+    }
 
     if (strstr(snd_card_name, "msm8x16") || strstr(snd_card_name, "msm8939") ||
         strstr(snd_card_name, "msm8909")) {