public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] fs/pstore: Optimization function ramoops_init_przs
@ 2015-03-18  1:41 Wang Long
  2015-03-18 20:11 ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Wang Long @ 2015-03-18  1:41 UTC (permalink / raw)
  To: keescook, anton, ccross, tony.luck
  Cc: linux-kernel, long.wanglong, peifeiyue, marco.stornelli,
	anton.vorontsov, salyzyn, sergiu

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>
---
 fs/pstore/ram.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 44a549b..f29373d 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,
 	}
 
 	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;
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-04 10:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-18  1:41 [PATCH v2] fs/pstore: Optimization function ramoops_init_przs Wang Long
2015-03-18 20:11 ` Kees Cook
2015-05-04  9:30   ` long.wanglong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox