From: long.wanglong Date: Thu, 21 May 2015 16:47:22 +0000 (-0700) Subject: fs/pstore: Optimization function ramoops_init_przs X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=07239fc854ec61b3cdc400d2a50d322d39c673f6;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Acked-by: Kees Cook Signed-off-by: Tony Luck --- 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, } 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;