summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2014-05-22 08:14:30 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2014-05-22 08:14:30 -0700
commit6a23f4e12e3bac52c810c46f1c6d7b0d0468ce5e (patch)
tree418b2d547e8c10152b4d421cb4057489cba04bbf /drivers/char
parent9a15ab7300c9854e1ab44d69a310a3c7889de142 (diff)
parentc7d2a1137905fa388ce38285db2ce609f06c4aaf (diff)
Merge "diag: Add kmemleak_not_leak checks to avoid memleaks"
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/diag/diagmem.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/char/diag/diagmem.c b/drivers/char/diag/diagmem.c
index 27c284833787..3020b768fa7c 100644
--- a/drivers/char/diag/diagmem.c
+++ b/drivers/char/diag/diagmem.c
@@ -16,6 +16,10 @@
#include <linux/mempool.h>
#include <linux/mutex.h>
#include <asm/atomic.h>
+#include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/kmemleak.h>
+
#include "diagchar.h"
#include "diagfwd_bridge.h"
#include "diagfwd_hsic.h"
@@ -37,6 +41,7 @@ void *diagmem_alloc(struct diagchar_dev *driver, int size, int pool_type)
atomic_add(1, (atomic_t *)&driver->count);
buf = mempool_alloc(driver->diagpool,
GFP_ATOMIC);
+ kmemleak_not_leak(buf);
}
}
} else if (pool_type == POOL_TYPE_HDLC) {
@@ -47,6 +52,7 @@ void *diagmem_alloc(struct diagchar_dev *driver, int size, int pool_type)
(atomic_t *)&driver->count_hdlc_pool);
buf = mempool_alloc(driver->diag_hdlc_pool,
GFP_ATOMIC);
+ kmemleak_not_leak(buf);
}
}
} else if (pool_type == POOL_TYPE_USER) {
@@ -57,6 +63,7 @@ void *diagmem_alloc(struct diagchar_dev *driver, int size, int pool_type)
(atomic_t *)&driver->count_user_pool);
buf = mempool_alloc(driver->diag_user_pool,
GFP_ATOMIC);
+ kmemleak_not_leak(buf);
}
}
} else if (pool_type == POOL_TYPE_WRITE_STRUCT) {
@@ -68,6 +75,7 @@ void *diagmem_alloc(struct diagchar_dev *driver, int size, int pool_type)
(atomic_t *)&driver->count_write_struct_pool);
buf = mempool_alloc(
driver->diag_write_struct_pool, GFP_ATOMIC);
+ kmemleak_not_leak(buf);
}
}
} else if (pool_type == POOL_TYPE_DCI) {
@@ -78,6 +86,7 @@ void *diagmem_alloc(struct diagchar_dev *driver, int size, int pool_type)
(atomic_t *)&driver->count_dci_pool);
buf = mempool_alloc(driver->diag_dci_pool,
GFP_ATOMIC);
+ kmemleak_not_leak(buf);
}
}
#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
@@ -93,6 +102,7 @@ void *diagmem_alloc(struct diagchar_dev *driver, int size, int pool_type)
buf = mempool_alloc(
diag_hsic[index].diag_hsic_pool,
GFP_ATOMIC);
+ kmemleak_not_leak(buf);
}
}
} else if (pool_type == POOL_TYPE_HSIC_WRITE ||
@@ -108,6 +118,7 @@ void *diagmem_alloc(struct diagchar_dev *driver, int size, int pool_type)
buf = mempool_alloc(
diag_hsic[index].diag_hsic_write_pool,
GFP_ATOMIC);
+ kmemleak_not_leak(buf);
}
}
} else if (pool_type == POOL_TYPE_HSIC_DCI ||
@@ -122,6 +133,7 @@ void *diagmem_alloc(struct diagchar_dev *driver, int size, int pool_type)
buf = mempool_alloc(
diag_hsic_dci[index].diag_hsic_pool,
GFP_ATOMIC);
+ kmemleak_not_leak(buf);
}
}
} else if (pool_type == POOL_TYPE_HSIC_DCI_WRITE ||
@@ -137,6 +149,7 @@ void *diagmem_alloc(struct diagchar_dev *driver, int size, int pool_type)
buf = mempool_alloc(
diag_hsic_dci[index].diag_hsic_write_pool,
GFP_ATOMIC);
+ kmemleak_not_leak(buf);
}
}
#endif