USB: HAL: handling readFile failure on device path

Currently readFile() is called without checking if
the operation succeeded in reading the bInterfaceClass value.

Return from function if readfile fails to populate bInterfaceClass
to avoid doing operation on NULL variables leading usb hal crash.

Change-Id: I7009305fa91541e22b99732620a586742a1b5f0c
diff --git a/hal/Usb.cpp b/hal/Usb.cpp
index 1cf2a5a..083ad73 100644
--- a/hal/Usb.cpp
+++ b/hal/Usb.cpp
@@ -1064,9 +1064,16 @@
 static bool checkUsbInterfaceAutoSuspend(const std::string& devicePath,
         const std::string &intf) {
   std::string bInterfaceClass;
-  int interfaceClass, ret = -1;
+  int interfaceClass, ret = -1, retry = 3;
 
-  readFile(devicePath + "/" + intf + "/bInterfaceClass", &bInterfaceClass);
+  do {
+	  readFile(devicePath + "/" + intf + "/bInterfaceClass",
+			  &bInterfaceClass);
+  } while ((--retry > 0) && (bInterfaceClass.length() == 0));
+
+  if (bInterfaceClass.length() == 0) {
+	  return false;
+  }
   interfaceClass = std::stoi(bInterfaceClass, 0, 16);
 
   // allow autosuspend for certain class devices