Merge 9a085604ae9a304f2cb4056492caa47467385e11 on remote branch

Change-Id: I132042df4058ee18cccc70213abe4fdb5eac49cc
diff --git a/etc/init.qti.usb.debug.sh b/etc/init.qti.usb.debug.sh
index 3e77d14..3c1fab4 100644
--- a/etc/init.qti.usb.debug.sh
+++ b/etc/init.qti.usb.debug.sh
@@ -54,6 +54,9 @@
     echo 1 > $tracefs/instances/usb/events/dwc3/dwc3_gadget_giveback/enable
     echo 1 > $tracefs/instances/usb/events/dwc3/dwc3_prepare_trb/enable
     echo 1 > $tracefs/instances/usb/events/dwc3/dwc3_event/enable
+    echo 1 > $tracefs/instances/dwc3_readl/events/dwc3/dwc3_alloc_request/enable
+    echo 1 > $tracefs/instances/dwc3_readl/events/dwc3/dwc3_free_request/enable
+    echo 1 > $tracefs/instances/dwc3_readl/events/dwc3/dwc3_gadget_generic_cmd/enable
 
     # ucsi
     echo 1 > $tracefs/instances/usb/events/ucsi/ucsi_connector_change/enable
@@ -77,4 +80,9 @@
 
     echo 1 > $tracefs/instances/usb_xhci/tracing_on
     echo 1 > $tracefs/instances/usb/tracing_on
+
+    #dwc3_readl_writel
+    mkdir $tracefs/instances/dwc3_rw_traces
+    echo 1 > $tracefs/instances/dwc3_rw_traces/events/dwc3/dwc3_readl/enable
+    echo 1 > $tracefs/instances/dwc3_rw_traces/events/dwc3/dwc3_writel/enable
 fi
diff --git a/hal/UsbGadget.cpp b/hal/UsbGadget.cpp
index 65a8c09..10173e0 100644
--- a/hal/UsbGadget.cpp
+++ b/hal/UsbGadget.cpp
@@ -107,6 +107,8 @@
 
 Return<void> UsbGadget::getCurrentUsbFunctions(
     const sp<V1_0::IUsbGadgetCallback> &callback) {
+  if (!callback) return Void();
+
   Return<void> ret = callback->getCurrentUsbFunctionsCb(
       mCurrentUsbFunctions, mCurrentUsbFunctionsApplied
                                 ? Status::FUNCTIONS_APPLIED