|
@@ -86,6 +86,7 @@ struct ramoops_context {
|
|
|
struct persistent_ram_ecc_info ecc_info;
|
|
|
unsigned int max_dump_cnt;
|
|
|
unsigned int dump_write_cnt;
|
|
|
+ /* _read_cnt need clear on ramoops_pstore_open */
|
|
|
unsigned int dump_read_cnt;
|
|
|
unsigned int console_read_cnt;
|
|
|
unsigned int ftrace_read_cnt;
|
|
@@ -101,6 +102,7 @@ static int ramoops_pstore_open(struct pstore_info *psi)
|
|
|
|
|
|
cxt->dump_read_cnt = 0;
|
|
|
cxt->console_read_cnt = 0;
|
|
|
+ cxt->ftrace_read_cnt = 0;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -117,13 +119,15 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max,
|
|
|
return NULL;
|
|
|
|
|
|
prz = przs[i];
|
|
|
+ if (!prz)
|
|
|
+ return NULL;
|
|
|
|
|
|
- if (update) {
|
|
|
- /* Update old/shadowed buffer. */
|
|
|
+ /* Update old/shadowed buffer. */
|
|
|
+ if (update)
|
|
|
persistent_ram_save_old(prz);
|
|
|
- if (!persistent_ram_old_size(prz))
|
|
|
- return NULL;
|
|
|
- }
|
|
|
+
|
|
|
+ if (!persistent_ram_old_size(prz))
|
|
|
+ return NULL;
|
|
|
|
|
|
*typep = type;
|
|
|
*id = i;
|
|
@@ -316,6 +320,7 @@ static void ramoops_free_przs(struct ramoops_context *cxt)
|
|
|
{
|
|
|
int i;
|
|
|
|
|
|
+ cxt->max_dump_cnt = 0;
|
|
|
if (!cxt->przs)
|
|
|
return;
|
|
|
|
|
@@ -346,7 +351,7 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
|
|
|
GFP_KERNEL);
|
|
|
if (!cxt->przs) {
|
|
|
dev_err(dev, "failed to initialize a prz array for dumps\n");
|
|
|
- return -ENOMEM;
|
|
|
+ goto fail_prz;
|
|
|
}
|
|
|
|
|
|
for (i = 0; i < cxt->max_dump_cnt; i++) {
|
|
@@ -428,7 +433,6 @@ static int ramoops_probe(struct platform_device *pdev)
|
|
|
if (pdata->ftrace_size && !is_power_of_2(pdata->ftrace_size))
|
|
|
pdata->ftrace_size = rounddown_pow_of_two(pdata->ftrace_size);
|
|
|
|
|
|
- cxt->dump_read_cnt = 0;
|
|
|
cxt->size = pdata->mem_size;
|
|
|
cxt->phys_addr = pdata->mem_address;
|
|
|
cxt->record_size = pdata->record_size;
|
|
@@ -505,7 +509,6 @@ fail_buf:
|
|
|
kfree(cxt->pstore.buf);
|
|
|
fail_clear:
|
|
|
cxt->pstore.bufsize = 0;
|
|
|
- cxt->max_dump_cnt = 0;
|
|
|
fail_cnt:
|
|
|
kfree(cxt->fprz);
|
|
|
fail_init_fprz:
|