aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlong.wanglong <long.wanglong@huawei.com>2015-05-21 12:47:22 -0400
committerTony Luck <tony.luck@intel.com>2015-05-21 12:47:22 -0400
commit07239fc854ec61b3cdc400d2a50d322d39c673f6 (patch)
tree55183d6636f9443e71f47b195fc574f850f1b139
parent42222c2a5d5da7fe4839491d5c44034f40761071 (diff)
fs/pstore: Optimization function ramoops_init_przs
The value of cxt->record_size does not change in the loop, so this patch optimize the assign statement by dropping sz entirely and using cxt->record_size in its place. Signed-off-by: Wang Long <long.wanglong@huawei.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r--fs/pstore/ram.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 44a549beeafa..f29373d299b0 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -394,18 +394,16 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
394 } 394 }
395 395
396 for (i = 0; i < cxt->max_dump_cnt; i++) { 396 for (i = 0; i < cxt->max_dump_cnt; i++) {
397 size_t sz = cxt->record_size; 397 cxt->przs[i] = persistent_ram_new(*paddr, cxt->record_size, 0,
398
399 cxt->przs[i] = persistent_ram_new(*paddr, sz, 0,
400 &cxt->ecc_info, 398 &cxt->ecc_info,
401 cxt->memtype); 399 cxt->memtype);
402 if (IS_ERR(cxt->przs[i])) { 400 if (IS_ERR(cxt->przs[i])) {
403 err = PTR_ERR(cxt->przs[i]); 401 err = PTR_ERR(cxt->przs[i]);
404 dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n", 402 dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n",
405 sz, (unsigned long long)*paddr, err); 403 cxt->record_size, (unsigned long long)*paddr, err);
406 goto fail_prz; 404 goto fail_prz;
407 } 405 }
408 *paddr += sz; 406 *paddr += cxt->record_size;
409 } 407 }
410 408
411 return 0; 409 return 0;