diff --git a/qdf/inc/qdf_tracker.h b/qdf/inc/qdf_tracker.h index 04dee0e7b2..bece8a77b0 100644 --- a/qdf/inc/qdf_tracker.h +++ b/qdf/inc/qdf_tracker.h @@ -1,5 +1,7 @@ /* * Copyright (c) 2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -60,6 +62,7 @@ struct qdf_tracker name = { \ .ht = qdf_ptr_hash_ptr(name ## _ht), \ } +#ifdef CONFIG_LEAK_DETECTION /** * qdf_tracker_init() - initialize a qdf_tracker * @tracker: the qdf_tracker to initialize @@ -125,6 +128,42 @@ qdf_must_check bool qdf_tracker_lookup(struct qdf_tracker *tracker, void *ptr, char (*out_func)[QDF_TRACKER_FUNC_SIZE], uint32_t *out_line); +#else +static inline +void qdf_tracker_init(struct qdf_tracker *tracker) +{ +} +static inline +void qdf_tracker_deinit(struct qdf_tracker *tracker) +{ +} + +static inline qdf_must_check QDF_STATUS +qdf_tracker_track(struct qdf_tracker *tracker, void *ptr, + const char *func, uint32_t line) +{ + return QDF_STATUS_SUCCESS; +} + +static inline +void qdf_tracker_untrack(struct qdf_tracker *tracker, void *ptr, + const char *func, uint32_t line) +{ +} + +static inline +void qdf_tracker_check_for_leaks(struct qdf_tracker *tracker) +{ +} + +static inline qdf_must_check bool +qdf_tracker_lookup(struct qdf_tracker *tracker, void *ptr, + char (*out_func)[QDF_TRACKER_FUNC_SIZE], + uint32_t *out_line) +{ + return false; +} +#endif #endif /* __QDF_TRACKER_H */ diff --git a/qdf/src/qdf_tracker.c b/qdf/src/qdf_tracker.c index 92c5d3db2d..6214de2e26 100644 --- a/qdf/src/qdf_tracker.c +++ b/qdf/src/qdf_tracker.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2019, 2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -26,6 +27,7 @@ #include "qdf_tracker.h" #include "qdf_types.h" +#ifdef CONFIG_LEAK_DETECTION struct qdf_tracker_node { struct qdf_ptr_hash_entry entry; enum qdf_debug_domain domain; @@ -186,4 +188,4 @@ bool qdf_tracker_lookup(struct qdf_tracker *tracker, void *ptr, return !!node; } - +#endif diff --git a/qdf/test/qdf_tracker_test.c b/qdf/test/qdf_tracker_test.c index b1bd7a8968..219a89bd9c 100644 --- a/qdf/test/qdf_tracker_test.c +++ b/qdf/test/qdf_tracker_test.c @@ -1,5 +1,7 @@ /* * Copyright (c) 2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -21,6 +23,7 @@ #include "qdf_trace.h" #include "qdf_types.h" +#if defined(CONFIG_LEAK_DETECTION) && defined(WLAN_TRACKER_TEST) #define qdf_ut_tracker_bits 4 /* 16 buckets */ #define qdf_ut_tracker_item_count 3 #define qdf_ut_tracker_declare(name) \ @@ -92,4 +95,4 @@ uint32_t qdf_tracker_unit_test(void) return errors; } - +#endif diff --git a/qdf/test/qdf_tracker_test.h b/qdf/test/qdf_tracker_test.h index 8500f51104..4b7d7968e1 100644 --- a/qdf/test/qdf_tracker_test.h +++ b/qdf/test/qdf_tracker_test.h @@ -1,5 +1,7 @@ /* * Copyright (c) 2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -19,7 +21,7 @@ #ifndef __QDF_TRACKER_TEST #define __QDF_TRACKER_TEST -#ifdef WLAN_TRACKER_TEST +#if defined(CONFIG_LEAK_DETECTION) && defined(WLAN_TRACKER_TEST) /** * qdf_tracker_unit_test() - run the qdf tracker unit test suite *