Prechádzať zdrojové kódy

qcacld-3.0: Add hdd_check_for_leaks function docs

In cases where memory allocated at runtime is release during module
unload, it is tempting to label these memory leaks as false positives.
Add documentation to hdd_check_for_leaks explaining why these are real
memory leaks. This helps reduce confusion, and helps to dissuade
developers from "fixing" the runtime memory leak logic, instead of
fixing the memory leak.

Change-Id: I2f7574e7465630d2d9f96280ecf8180a51b41e0f
CRs-Fixed: 2161394
Dustin Brown 7 rokov pred
rodič
commit
4c5b990170
1 zmenil súbory, kde vykonal 15 pridanie a 0 odobranie
  1. 15 0
      core/hdd/src/wlan_hdd_main.c

+ 15 - 0
core/hdd/src/wlan_hdd_main.c

@@ -2348,8 +2348,23 @@ static void hdd_nan_register_callbacks(struct hdd_context *hdd_ctx)
 }
 #endif
 
+/**
+ * hdd_check_for_leaks() - Perform runtime memory leak checks
+ *
+ * This API triggers runtime memory leak detection. This feature enforces the
+ * policy that any memory allocated at runtime must also be released at runtime.
+ *
+ * Allocating memory at runtime and releasing it at unload is effectively a
+ * memory leak for configurations which never unload (e.g. LONU, statically
+ * compiled driver). Such memory leaks are NOT false positives, and must be
+ * fixed.
+ *
+ * Return: None
+ */
 static void hdd_check_for_leaks(void)
 {
+	/* DO NOT REMOVE these checks; for false positives, read above first */
+
 	qdf_mc_timer_check_for_leaks();
 }