disp: msm: sde: use devm_kzalloc for debug dumps

Upstream has added an "enhancement" to the DMA allocator to
reject coherent allocations less than a a full page, so allocate
device managed memory instead of artificially inflating the
buffer sizes. This has the added benefit of having this memory
automatically freed when the module is unloaded, avoiding
possible leaks.

Change-Id: I653f2cd1f06f1a352cd61e36ea8baaf7c30efd98
Signed-off-by: Steve Cohen <cohens@codeaurora.org>
此提交包含在:
Steve Cohen
2020-03-16 16:02:23 -04:00
父節點 b15ed9edec
當前提交 7fe084620e
共有 2 個檔案被更改,包括 14 行新增21 行删除

查看文件

@@ -2949,11 +2949,9 @@ static void _sde_dump_reg(const char *dump_name, u32 reg_dump_flag,
end_addr = addr + len_bytes;
if (in_mem) {
if (dump_mem && !(*dump_mem)) {
phys_addr_t phys = 0;
*dump_mem = dma_alloc_coherent(sde_dbg_base.dev,
len_padded, &phys, GFP_KERNEL);
}
if (dump_mem && !(*dump_mem))
*dump_mem = devm_kzalloc(sde_dbg_base.dev, len_padded,
GFP_KERNEL);
if (dump_mem && *dump_mem) {
dump_addr = *dump_mem;
@@ -3189,7 +3187,6 @@ static void _sde_dbg_dump_sde_dbg_bus(struct sde_dbg_sde_debug_bus *bus)
u32 *dump_addr = NULL;
u32 status = 0;
struct sde_debug_bus_entry *head;
phys_addr_t phys = 0;
int list_size;
int i;
u32 offset;
@@ -3227,8 +3224,8 @@ static void _sde_dbg_dump_sde_dbg_bus(struct sde_dbg_sde_debug_bus *bus)
if (in_mem) {
if (!(*dump_mem))
*dump_mem = dma_alloc_coherent(sde_dbg_base.dev,
list_size, &phys, GFP_KERNEL);
*dump_mem = devm_kzalloc(sde_dbg_base.dev, list_size,
GFP_KERNEL);
if (*dump_mem) {
dump_addr = *dump_mem;
@@ -3338,7 +3335,6 @@ static void _sde_dbg_dump_vbif_dbg_bus(struct sde_dbg_vbif_debug_bus *bus)
u32 value, d0, d1;
unsigned long reg, reg1, reg2;
struct vbif_debug_bus_entry *head;
phys_addr_t phys = 0;
int i, list_size = 0;
void __iomem *mem_base = NULL;
struct vbif_debug_bus_entry *dbg_bus;
@@ -3388,8 +3384,8 @@ static void _sde_dbg_dump_vbif_dbg_bus(struct sde_dbg_vbif_debug_bus *bus)
if (in_mem) {
if (!(*dump_mem))
*dump_mem = dma_alloc_coherent(sde_dbg_base.dev,
list_size, &phys, GFP_KERNEL);
*dump_mem = devm_kzalloc(sde_dbg_base.dev, list_size,
GFP_KERNEL);
if (*dump_mem) {
dump_addr = *dump_mem;