Skip to content

Commit

Permalink
fs/pstore: Optimization function ramoops_init_przs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
long.wanglong authored and Tony Luck committed May 21, 2015
1 parent 42222c2 commit 07239fc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions fs/pstore/ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,18 +394,16 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
}

for (i = 0; i < cxt->max_dump_cnt; i++) {
size_t sz = cxt->record_size;

cxt->przs[i] = persistent_ram_new(*paddr, sz, 0,
cxt->przs[i] = persistent_ram_new(*paddr, cxt->record_size, 0,
&cxt->ecc_info,
cxt->memtype);
if (IS_ERR(cxt->przs[i])) {
err = PTR_ERR(cxt->przs[i]);
dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n",
sz, (unsigned long long)*paddr, err);
cxt->record_size, (unsigned long long)*paddr, err);
goto fail_prz;
}
*paddr += sz;
*paddr += cxt->record_size;
}

return 0;
Expand Down

0 comments on commit 07239fc

Please sign in to comment.