lkml.org 
[lkml]   [2015]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] fs/pstore: Optimization function ramoops_init_przs
From
On Tue, Mar 17, 2015 at 2:31 AM, Wang Long <long.wanglong@huawei.com> wrote:
> The value of cxt->record_size does not change in the loop,
> so this patch optimize the assign statement by moving
> it to outer.
>
> Signed-off-by: Wang Long <long.wanglong@huawei.com>
> ---
> fs/pstore/ram.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
> index 44a549b..2105a16 100644
> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c
> @@ -373,6 +373,7 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
> {
> int err = -ENOMEM;
> int i;
> + size_t sz;
>
> if (!cxt->record_size)
> return 0;
> @@ -393,9 +394,8 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
> goto fail_prz;
> }
>
> + sz = cxt->record_size;
> 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->ecc_info,
> cxt->memtype);
> --
> 1.8.3.4
>

Actually, can't we drop sz entirely and just use cxt->record_size in its place?

-Kees

--
Kees Cook
Chrome OS Security


\
 
 \ /
  Last update: 2015-03-17 19:01    [W:0.047 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site