Loading...
iokit/Kernel/IOSimpleReporter.cpp xnu-12377.121.6 xnu-6153.41.3
--- xnu/xnu-12377.121.6/iokit/Kernel/IOSimpleReporter.cpp
+++ xnu/xnu-6153.41.3/iokit/Kernel/IOSimpleReporter.cpp
@@ -26,9 +26,6 @@
  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 
-#define IOKIT_ENABLE_SHARED_PTR
-
-#include <libkern/c++/OSSharedPtr.h>
 #include <IOKit/IOKernelReportStructs.h>
 #include <IOKit/IOKernelReporters.h>
 #include "IOReporterDefs.h"
@@ -37,23 +34,34 @@
 OSDefineMetaClassAndStructors(IOSimpleReporter, IOReporter);
 
 /* static */
-OSSharedPtr<IOSimpleReporter>
+IOSimpleReporter*
 IOSimpleReporter::with(IOService *reportingService,
     IOReportCategories categories,
     IOReportUnit unit)
 {
-	OSSharedPtr<IOSimpleReporter> reporter;
+	IOSimpleReporter *reporter, *rval = NULL;
 
-	reporter = OSMakeShared<IOSimpleReporter>();
+	// kprintf("%s\n", __func__);      // can't IORLOG() from static
+
+	reporter = new IOSimpleReporter;
 	if (!reporter) {
-		return nullptr;
+		goto finish;
 	}
 
+
 	if (!reporter->initWith(reportingService, categories, unit)) {
-		return nullptr;
+		goto finish;
 	}
 
-	return reporter;
+	// success
+	rval = reporter;
+
+finish:
+	if (!rval) {
+		OSSafeReleaseNULL(reporter);
+	}
+
+	return rval;
 }
 
 bool
@@ -152,20 +160,3 @@
 	unlockReporter();
 	return simple_value;
 }
-
-/* static */ OSPtr<IOReportLegendEntry>
-IOSimpleReporter::createLegend(const uint64_t *channelIDs,
-    const char **channelNames,
-    int channelCount,
-    IOReportCategories categories,
-    IOReportUnit unit)
-{
-	IOReportChannelType channelType = {
-		.categories = categories,
-		.report_format = kIOReportFormatSimple,
-		.nelements = 1,
-		.element_idx = 0
-	};
-
-	return IOReporter::legendWith(channelIDs, channelNames, channelCount, channelType, unit);
-}