Loading...
bsd/net/devtimer.c xnu-12377.121.6 xnu-7195.141.2
--- xnu/xnu-12377.121.6/bsd/net/devtimer.c
+++ xnu/xnu-7195.141.2/bsd/net/devtimer.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2004,2007-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  *
@@ -64,6 +64,8 @@
 	struct os_refcnt            dt_retain_count;
 };
 
+#define M_DEVTIMER      M_DEVBUF
+
 static __inline__ void
 timeval_add(struct timeval tv1, struct timeval tv2,
     struct timeval * result)
@@ -120,7 +122,7 @@
 {
 	if (os_ref_release(&timer->dt_retain_count) == 0) {
 		devtimer_invalidate(timer);
-		kfree_type(struct devtimer_s, timer);
+		FREE(timer, M_DEVTIMER);
 		_devtimer_printf("devtimer: timer released\n");
 	}
 }
@@ -162,7 +164,10 @@
 {
 	devtimer_ref        timer;
 
-	timer = kalloc_type(struct devtimer_s, Z_WAITOK | Z_ZERO | Z_NOFAIL);
+	timer = _MALLOC(sizeof(*timer), M_DEVTIMER, M_WAITOK | M_ZERO);
+	if (timer == NULL) {
+		return timer;
+	}
 	os_ref_init(&timer->dt_retain_count, NULL);
 	timer->dt_callout = thread_call_allocate(devtimer_process, timer);
 	if (timer->dt_callout == NULL) {