From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 7/7] GCC4.6: Squash warning in cmd_mem.c
Date: Mon, 26 Sep 2011 20:24:57 +0200 [thread overview]
Message-ID: <201109262024.58486.marek.vasut@gmail.com> (raw)
In-Reply-To: <CAPnjgZ12syyHOf_L5xH9A=O0vL=X2W_wd8QFFFZvFqo7ZsCG1g@mail.gmail.com>
On Monday, September 26, 2011 08:05:43 PM Simon Glass wrote:
> Hi Marek,
>
> On Sun, Sep 25, 2011 at 5:26 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> > cmd_mem.c: In function ?do_mem_loop?:
> > cmd_mem.c:474:25: warning: variable ?junk? set but not used
> > [-Wunused-but-set-variable]
> >
> > The assigned variable can be removed because the pointers are volatile so
> > accesses to their addresses are always generated.
> >
> > Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> > ---
> > common/cmd_mem.c | 8 ++++----
> > 1 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/common/cmd_mem.c b/common/cmd_mem.c
> > index 4daa1b3..e84cc4e 100644
> > --- a/common/cmd_mem.c
> > +++ b/common/cmd_mem.c
> > @@ -471,7 +471,7 @@ int do_mem_base (cmd_tbl_t *cmdtp, int flag, int
> > argc, char * const argv[])
> >
> > int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char * const
> > argv[]) {
> > - ulong addr, length, i, junk;
> > + ulong addr, length, i;
> > int size;
> > volatile uint *longp;
> > volatile ushort *shortp;
> > @@ -518,7 +518,7 @@ int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int
> > argc, char * const argv[]) longp = (uint *)addr;
> > i = length;
> > while (i-- > 0)
> > - junk = *longp++;
> > + *longp++;
> > }
> > }
> > if (size == 2) {
> > @@ -526,14 +526,14 @@ int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int
> > argc, char * const argv[]) shortp = (ushort *)addr;
> > i = length;
> > while (i-- > 0)
> > - junk = *shortp++;
> > + *shortp++;
> > }
> > }
> > for (;;) {
> > cp = (u_char *)addr;
> > i = length;
> > while (i-- > 0)
> > - junk = *cp++;
> > + *cp++;
> > }
> > }
>
> I checked the ARM assembler output and it looks fine.
>
> Acked-by: Simon Glass <sjg@chromium.org>
>
> Re the 'length == 1' case (above your patch) site, it is assigning to
> 'i' here. Could/should we remove that assignment also?
The loop below depends on that ... ?
>
> Regards,
> Simon
>
> > --
> > 1.7.5.4
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot at lists.denx.de
> > http://lists.denx.de/mailman/listinfo/u-boot
next prev parent reply other threads:[~2011-09-26 18:24 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-26 0:26 [U-Boot] [PATCH 1/7 V2] GCC4.6: Convert various empty macros to inline functions Marek Vasut
2011-09-26 0:26 ` [U-Boot] [PATCH 2/7 RESEND] GCC4.6: Remove unused "port" variable in cmd_usb.c Marek Vasut
2011-09-26 3:40 ` Mike Frysinger
2011-09-26 0:26 ` [U-Boot] [PATCH 3/7] GCC4.6: Squash warning in cmd_flash.c Marek Vasut
2011-10-01 21:25 ` Wolfgang Denk
2011-09-26 0:26 ` [U-Boot] [PATCH 4/7] GCC4.6: Squash warning in cmd_nvedit.c Marek Vasut
2011-09-26 3:39 ` Mike Frysinger
2011-09-26 3:40 ` Mike Frysinger
2011-09-26 18:15 ` Simon Glass
2011-10-01 21:26 ` Wolfgang Denk
2011-09-26 0:26 ` [U-Boot] [PATCH 5/7] GCC4.6: Squash warnings in lcd.c Marek Vasut
2011-10-01 21:26 ` Wolfgang Denk
2011-09-26 0:26 ` [U-Boot] [PATCH 6/7] GCC4.6: Squash warnings in ipu_disp.c Marek Vasut
2011-10-01 21:27 ` Wolfgang Denk
2011-09-26 0:26 ` [U-Boot] [PATCH 7/7] GCC4.6: Squash warning in cmd_mem.c Marek Vasut
2011-09-26 3:41 ` Mike Frysinger
2011-09-26 7:25 ` Wolfgang Denk
2011-09-26 9:03 ` Marek Vasut
2011-09-26 16:10 ` Mike Frysinger
2011-09-26 17:31 ` Marek Vasut
2011-09-26 18:03 ` Wolfgang Denk
2011-09-26 18:29 ` Marek Vasut
2011-09-26 18:49 ` Wolfgang Denk
2011-09-26 19:52 ` Mike Frysinger
2011-09-26 18:05 ` Simon Glass
2011-09-26 18:24 ` Marek Vasut [this message]
2011-09-26 18:29 ` Simon Glass
2011-09-26 18:34 ` Marek Vasut
2011-09-26 19:01 ` Simon Glass
2011-09-26 19:10 ` Marek Vasut
2011-09-26 19:13 ` Simon Glass
2011-10-01 21:27 ` Wolfgang Denk
2011-09-26 2:39 ` [U-Boot] [PATCH 1/7 V2] GCC4.6: Convert various empty macros to inline functions Fabio Estevam
2011-09-26 9:04 ` Marek Vasut
2011-09-26 11:28 ` Wolfgang Denk
2011-09-26 3:41 ` Mike Frysinger
2011-09-26 17:36 ` [U-Boot] [PATCH 1/7 V3] " Marek Vasut
2011-10-01 21:20 ` Wolfgang Denk
2011-10-02 18:36 ` Wolfgang Denk
2011-10-02 19:08 ` Marek Vasut
2011-10-02 22:50 ` Marek Vasut
2011-10-03 18:32 ` [U-Boot] [PATCH 1/7 V2] " Marek Vasut
2011-10-03 18:36 ` Wolfgang Denk
2011-10-03 18:42 ` Marek Vasut
2011-10-03 22:58 ` Marek Vasut
2011-10-04 12:18 ` Marek Vasut
2011-10-04 19:06 ` Marek Vasut
2011-10-04 19:23 ` Wolfgang Denk
2011-10-04 19:46 ` Mike Frysinger
2011-10-04 20:44 ` Wolfgang Denk
2011-10-04 20:58 ` Marek Vasut
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=201109262024.58486.marek.vasut@gmail.com \
--to=marek.vasut@gmail.com \
--cc=u-boot@lists.denx.de \
/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