提交 07239fc8 编写于 作者: L long.wanglong 提交者: Tony Luck

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: NWang Long <long.wanglong@huawei.com>
Acked-by: NKees Cook <keescook@chromium.org>
Signed-off-by: NTony Luck <tony.luck@intel.com>
上级 42222c2a
...@@ -394,18 +394,16 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt, ...@@ -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++) { for (i = 0; i < cxt->max_dump_cnt; i++) {
size_t sz = cxt->record_size; cxt->przs[i] = persistent_ram_new(*paddr, cxt->record_size, 0,
cxt->przs[i] = persistent_ram_new(*paddr, sz, 0,
&cxt->ecc_info, &cxt->ecc_info,
cxt->memtype); cxt->memtype);
if (IS_ERR(cxt->przs[i])) { if (IS_ERR(cxt->przs[i])) {
err = PTR_ERR(cxt->przs[i]); err = PTR_ERR(cxt->przs[i]);
dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n", 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; goto fail_prz;
} }
*paddr += sz; *paddr += cxt->record_size;
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册