linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Julia Lawall <julia@diku.dk>
Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org
Subject: Re: question about drivers/mtd/ubi/cdev.c
Date: Wed, 04 Aug 2010 06:06:52 +0300	[thread overview]
Message-ID: <1280891212.4363.5.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.64.1008032206060.20393@ask.diku.dk>

On Tue, 2010-08-03 at 22:12 +0200, Julia Lawall wrote:
> I was wondering about the following code in the function rename_volumes in 
> the file drivers/mtd/ubi/cdev.c:
> 
> list_for_each_entry(re, &rename_list, list) {
> 	...
>         if (no_remove_needed)
>                 continue;
> 	...
>         re = kzalloc(sizeof(struct ubi_rename_entry), GFP_KERNEL);
> 	if (!re) { ... }
>         re->remove = 1;
>         re->desc = desc;
>         list_add(&re->list, &rename_list);
> 	...
> }
> 
> Is there a danger of repeating computation since re is redefined and moved 
> back to the beginning of the list?

Hmm, the code is bogus, I do not know how it works, but it does, because
I tested it :-)

We should not use 're' as a temporary variable inside the loop. I guess
we can use 're1' instead. I'll change this later, when have time, unless
you submit a fix earlier :-)

Thanks for pointing this!

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

  reply	other threads:[~2010-08-04  3:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03 20:12 question about drivers/mtd/ubi/cdev.c Julia Lawall
2010-08-04  3:06 ` Artem Bityutskiy [this message]
2010-08-04  5:48   ` Julia Lawall
2010-08-04  6:37     ` Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1280891212.4363.5.camel@localhost.localdomain \
    --to=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=julia@diku.dk \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).