Loading...
iokit/Kernel/IOHistogramReporter.cpp xnu-4570.71.2 xnu-3789.31.2
--- xnu/xnu-4570.71.2/iokit/Kernel/IOHistogramReporter.cpp
+++ xnu/xnu-3789.31.2/iokit/Kernel/IOHistogramReporter.cpp
@@ -43,7 +43,7 @@
                           IOReportCategories categories,
                           uint64_t channelID,
                           const char *channelName,
-                          IOReportUnit unit,
+                          IOReportUnits unit,
                           int nSegments,
                           IOHistogramSegmentConfig *config)
 {
@@ -74,7 +74,7 @@
                               IOReportCategories categories,
                               uint64_t channelID,
                               const OSSymbol *channelName,
-                              IOReportUnit unit,
+                              IOReportUnits unit,
                               int nSegments,
                               IOHistogramSegmentConfig *config)
 {
@@ -272,35 +272,34 @@
 IOReportLegendEntry*
 IOHistogramReporter::handleCreateLegend(void)
 {
-    IOReportLegendEntry     *rval = NULL, *legendEntry = NULL;
-    OSData                  *tmpConfigData = NULL;
-    OSDictionary            *tmpDict;       // no refcount
+    OSData                  *tmpConfigData;
+    OSDictionary            *tmpDict;
+    IOReportLegendEntry     *legendEntry = NULL;
         
     legendEntry = super::handleCreateLegend();
-    if (!legendEntry)       goto finish;
-    
-    PREFL_MEMOP_PANIC(_segmentCount, IOHistogramSegmentConfig);
-    tmpConfigData = OSData::withBytes(_histogramSegmentsConfig,
-                         (unsigned)_segmentCount *
-                             sizeof(IOHistogramSegmentConfig));
-    if (!tmpConfigData)         goto finish;
-
-    tmpDict = OSDynamicCast(OSDictionary,
-                    legendEntry->getObject(kIOReportLegendInfoKey));
-    if (!tmpDict)               goto finish;
-
-    tmpDict->setObject(kIOReportLegendConfigKey, tmpConfigData);
-
-    // success
-    rval = legendEntry;
-
+    
+    if (legendEntry) {
+        
+        PREFL_MEMOP_PANIC(_segmentCount, IOHistogramSegmentConfig);
+        tmpConfigData = OSData::withBytes(_histogramSegmentsConfig,
+                                          (unsigned)_segmentCount *
+                                            (unsigned)sizeof(IOHistogramSegmentConfig));
+        if (!tmpConfigData) {
+            legendEntry->release();
+            goto finish;
+        }
+        
+        tmpDict = OSDynamicCast(OSDictionary, legendEntry->getObject(kIOReportLegendInfoKey));
+        if (!tmpDict) {
+            legendEntry->release();
+            goto finish;
+        }
+        
+        tmpDict->setObject(kIOReportLegendConfigKey, tmpConfigData);
+    }
+    
 finish:
-    if (tmpConfigData)  tmpConfigData->release();
-    if (!rval && legendEntry) {
-        legendEntry->release();
-    }
-
-    return rval;
+    return legendEntry;
 }
 
 IOReturn