diff options
Diffstat (limited to 'fs/pstore/ram.c')
| -rw-r--r-- | fs/pstore/ram.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index fa8cef2cca3a..3b5744306ed8 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c | |||
| @@ -86,6 +86,7 @@ struct ramoops_context { | |||
| 86 | struct persistent_ram_ecc_info ecc_info; | 86 | struct persistent_ram_ecc_info ecc_info; |
| 87 | unsigned int max_dump_cnt; | 87 | unsigned int max_dump_cnt; |
| 88 | unsigned int dump_write_cnt; | 88 | unsigned int dump_write_cnt; |
| 89 | /* _read_cnt need clear on ramoops_pstore_open */ | ||
| 89 | unsigned int dump_read_cnt; | 90 | unsigned int dump_read_cnt; |
| 90 | unsigned int console_read_cnt; | 91 | unsigned int console_read_cnt; |
| 91 | unsigned int ftrace_read_cnt; | 92 | unsigned int ftrace_read_cnt; |
| @@ -101,6 +102,7 @@ static int ramoops_pstore_open(struct pstore_info *psi) | |||
| 101 | 102 | ||
| 102 | cxt->dump_read_cnt = 0; | 103 | cxt->dump_read_cnt = 0; |
| 103 | cxt->console_read_cnt = 0; | 104 | cxt->console_read_cnt = 0; |
| 105 | cxt->ftrace_read_cnt = 0; | ||
| 104 | return 0; | 106 | return 0; |
| 105 | } | 107 | } |
| 106 | 108 | ||
| @@ -117,13 +119,15 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max, | |||
| 117 | return NULL; | 119 | return NULL; |
| 118 | 120 | ||
| 119 | prz = przs[i]; | 121 | prz = przs[i]; |
| 122 | if (!prz) | ||
| 123 | return NULL; | ||
| 120 | 124 | ||
| 121 | if (update) { | 125 | /* Update old/shadowed buffer. */ |
| 122 | /* Update old/shadowed buffer. */ | 126 | if (update) |
| 123 | persistent_ram_save_old(prz); | 127 | persistent_ram_save_old(prz); |
| 124 | if (!persistent_ram_old_size(prz)) | 128 | |
| 125 | return NULL; | 129 | if (!persistent_ram_old_size(prz)) |
| 126 | } | 130 | return NULL; |
| 127 | 131 | ||
| 128 | *typep = type; | 132 | *typep = type; |
| 129 | *id = i; | 133 | *id = i; |
| @@ -316,6 +320,7 @@ static void ramoops_free_przs(struct ramoops_context *cxt) | |||
| 316 | { | 320 | { |
| 317 | int i; | 321 | int i; |
| 318 | 322 | ||
| 323 | cxt->max_dump_cnt = 0; | ||
| 319 | if (!cxt->przs) | 324 | if (!cxt->przs) |
| 320 | return; | 325 | return; |
| 321 | 326 | ||
| @@ -346,7 +351,7 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt, | |||
| 346 | GFP_KERNEL); | 351 | GFP_KERNEL); |
| 347 | if (!cxt->przs) { | 352 | if (!cxt->przs) { |
| 348 | dev_err(dev, "failed to initialize a prz array for dumps\n"); | 353 | dev_err(dev, "failed to initialize a prz array for dumps\n"); |
| 349 | return -ENOMEM; | 354 | goto fail_prz; |
| 350 | } | 355 | } |
| 351 | 356 | ||
| 352 | for (i = 0; i < cxt->max_dump_cnt; i++) { | 357 | for (i = 0; i < cxt->max_dump_cnt; i++) { |
| @@ -428,7 +433,6 @@ static int ramoops_probe(struct platform_device *pdev) | |||
| 428 | if (pdata->ftrace_size && !is_power_of_2(pdata->ftrace_size)) | 433 | if (pdata->ftrace_size && !is_power_of_2(pdata->ftrace_size)) |
| 429 | pdata->ftrace_size = rounddown_pow_of_two(pdata->ftrace_size); | 434 | pdata->ftrace_size = rounddown_pow_of_two(pdata->ftrace_size); |
| 430 | 435 | ||
| 431 | cxt->dump_read_cnt = 0; | ||
| 432 | cxt->size = pdata->mem_size; | 436 | cxt->size = pdata->mem_size; |
| 433 | cxt->phys_addr = pdata->mem_address; | 437 | cxt->phys_addr = pdata->mem_address; |
| 434 | cxt->record_size = pdata->record_size; | 438 | cxt->record_size = pdata->record_size; |
| @@ -505,7 +509,6 @@ fail_buf: | |||
| 505 | kfree(cxt->pstore.buf); | 509 | kfree(cxt->pstore.buf); |
| 506 | fail_clear: | 510 | fail_clear: |
| 507 | cxt->pstore.bufsize = 0; | 511 | cxt->pstore.bufsize = 0; |
| 508 | cxt->max_dump_cnt = 0; | ||
| 509 | fail_cnt: | 512 | fail_cnt: |
| 510 | kfree(cxt->fprz); | 513 | kfree(cxt->fprz); |
| 511 | fail_init_fprz: | 514 | fail_init_fprz: |
