mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 04:42:04 -04:00
Merge "soc: qcom: Improve msm_minidump_remove_region api"
This commit is contained in:
commit
c2d5faac4e
1 changed files with 16 additions and 18 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "Minidump: " fmt
|
||||
|
|
@ -371,7 +371,7 @@ int msm_minidump_clear_headers(const struct md_region *entry)
|
|||
|
||||
int msm_minidump_remove_region(const struct md_region *entry)
|
||||
{
|
||||
int rcount, ecount, seq = 0, rgno, ret;
|
||||
int rcount, ecount, seq = 0, rgno, entryno, ret;
|
||||
unsigned long flags;
|
||||
|
||||
if (!entry || !minidump_table.md_ss_toc ||
|
||||
|
|
@ -381,30 +381,28 @@ int msm_minidump_remove_region(const struct md_region *entry)
|
|||
|
||||
spin_lock_irqsave(&mdt_lock, flags);
|
||||
write_lock(&mdt_remove_lock);
|
||||
entryno = md_entry_num(entry);
|
||||
rgno = md_region_num(entry->name, &seq);
|
||||
if (entryno < 0 || rgno < 0) {
|
||||
write_unlock(&mdt_remove_lock);
|
||||
spin_unlock_irqrestore(&mdt_lock, flags);
|
||||
pr_err("Not able to find the entry %s (%d,%d) in table\n",
|
||||
entry->name, entryno, rgno);
|
||||
return -EINVAL;
|
||||
}
|
||||
ecount = minidump_table.num_regions;
|
||||
rcount = minidump_table.md_ss_toc->ss_region_count;
|
||||
rgno = md_entry_num(entry);
|
||||
if (rgno < 0) {
|
||||
pr_err("Not able to find the entry in table\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (first_removed_entry > rgno)
|
||||
first_removed_entry = rgno;
|
||||
if (first_removed_entry > entryno)
|
||||
first_removed_entry = entryno;
|
||||
minidump_table.md_ss_toc->md_ss_toc_init = 0;
|
||||
|
||||
/* Remove entry from: entry list, ss region list and elf header */
|
||||
memmove(&minidump_table.entry[rgno], &minidump_table.entry[rgno + 1],
|
||||
((ecount - rgno - 1) * sizeof(struct md_region)));
|
||||
memmove(&minidump_table.entry[entryno],
|
||||
&minidump_table.entry[entryno + 1],
|
||||
((ecount - entryno - 1) * sizeof(struct md_region)));
|
||||
memset(&minidump_table.entry[ecount - 1], 0, sizeof(struct md_region));
|
||||
|
||||
|
||||
rgno = md_region_num(entry->name, &seq);
|
||||
if (rgno < 0) {
|
||||
pr_err("Not able to find region in table\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
memmove(&minidump_table.md_regions[rgno],
|
||||
&minidump_table.md_regions[rgno + 1],
|
||||
((rcount - rgno - 1) * sizeof(struct md_ss_region)));
|
||||
|
|
|
|||
Loading…
Reference in a new issue