public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 02/17] examples/eepro100_eeprom: Fix	memcpy to return destination pointer
Date: Mon, 19 May 2008 00:20:19 +0200	[thread overview]
Message-ID: <20080518222019.GC19480@game.jcrosoft.org> (raw)
In-Reply-To: <20080518222846.4846D2476E@gemini.denx.de>

On 00:28 Mon 19 May     , Wolfgang Denk wrote:
> In message <1211130599-28289-3-git-send-email-plagnioj@jcrosoft.com> you wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  examples/eepro100_eeprom.c |    5 ++++-
> >  1 files changed, 4 insertions(+), 1 deletions(-)
> > 
> > diff --git a/examples/eepro100_eeprom.c b/examples/eepro100_eeprom.c
> > index 2b15d05..5f4eb78 100644
> > --- a/examples/eepro100_eeprom.c
> > +++ b/examples/eepro100_eeprom.c
> > @@ -80,11 +80,13 @@ static inline short inw(long addr)
> >  static inline void *memcpy(void *dst, const void *src, unsigned int len)
> >  {
> >  	char *ret = dst;
> > +
> >  	while (len-- > 0) {
> >  		*ret++ = *((char *)src);
> >  		src++;
> >  	}
> > -	return (void *)ret;
> > +
> > +	return (void *)dst;
> 
> While technically correct, this is bogus. We have a variable ret, but
> we don't return it. And we have a variable dst, but we don't use it as
> destination pointer.
> 
> Please change the
> 	*ret++ = *((char *)src);
> into
> 	*dst++ = *((char *)src);
> and leave all the rest.
You can not do this because dst is a void

we can do this

	char *tmp = dst;

	while (len-- > 0) {
		*tmp++ = *((char *)src);
		src++;
	}

	return (void *)dst;

Best Regards,
J.

  reply	other threads:[~2008-05-18 22:20 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-18 17:09 [U-Boot-Users] [PATCH 00/17] x86: Fix warning: type qualifiers ignored on function return type Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09 ` [U-Boot-Users] [PATCH 01/17] example/82559_eeprom: Fix multiple warnings and errors Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09   ` [U-Boot-Users] [PATCH 02/17] examples/eepro100_eeprom: Fix memcpy to return destination pointer Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09     ` [U-Boot-Users] [PATCH 03/17] example/gitignore: update with all generated examples Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09       ` [U-Boot-Users] [PATCH 04/17] i386: Fix global_data declaration Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09         ` [U-Boot-Users] [PATCH 05/17] i386/bootm: remove unused var Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09           ` [U-Boot-Users] [PATCH 06/17] ds1722: Fix mutliple warnings and errors and active the ssi for SC520 boards Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09             ` [U-Boot-Users] [PATCH 07/17] drivers/pcmcia: add missing i82365 Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09               ` [U-Boot-Users] [PATCH 08/17] marabun_pcmcia: Move compile condition to the Makefile Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                 ` [U-Boot-Users] [PATCH 09/17] pxa_pcmcia: " Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                   ` [U-Boot-Users] [PATCH 10/17] pcmcia/ti_pci1410a: " Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                     ` [U-Boot-Users] [PATCH 11/17] Include pcmcia.h only when the drivers is used Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                       ` [U-Boot-Users] [PATCH 12/17] ti_pci1410a: Fix multiple warnings and errors Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                         ` [U-Boot-Users] [PATCH 13/17] sc520_spunk: Fix multiple warnings Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                           ` [U-Boot-Users] [PATCH 14/17] sc520_spunk: Fix flash Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                             ` [U-Boot-Users] [PATCH 15/17] sc530_spunk: add missing SOBJS entry Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                               ` [U-Boot-Users] [PATCH 16/17] i386: Fix multipple definition of __show_boot_progress Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 17:09                                 ` [U-Boot-Users] [PATCH 17/17] sc520_cdp: Fix multiple warnings Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 23:00                                   ` Wolfgang Denk
2008-05-18 22:59                                 ` [U-Boot-Users] [PATCH 16/17] i386: Fix multipple definition of __show_boot_progress Wolfgang Denk
2008-05-18 22:57                               ` [U-Boot-Users] [PATCH 15/17] sc530_spunk: add missing SOBJS entry Wolfgang Denk
2008-05-18 22:57                             ` [U-Boot-Users] [PATCH 14/17] sc520_spunk: Fix flash Wolfgang Denk
2008-05-18 22:55                           ` [U-Boot-Users] [PATCH 13/17] sc520_spunk: Fix multiple warnings Wolfgang Denk
2008-05-18 22:51                         ` [U-Boot-Users] [PATCH 12/17] ti_pci1410a: Fix multiple warnings and errors Wolfgang Denk
2008-05-18 22:44                       ` [U-Boot-Users] [PATCH 11/17] Include pcmcia.h only when the drivers is used Wolfgang Denk
2008-07-05 22:32                     ` [U-Boot-Users] [PATCH 10/17] pcmcia/ti_pci1410a: Move compile condition to the Makefile Wolfgang Denk
2008-07-05 22:32                   ` [U-Boot-Users] [PATCH 09/17] pxa_pcmcia: " Wolfgang Denk
2008-05-18 23:04                 ` [U-Boot-Users] [PATCH 08/17] marabun_pcmcia: " Wolfgang Denk
2008-07-05 22:32                 ` Wolfgang Denk
2008-05-18 22:40               ` [U-Boot-Users] [PATCH 07/17] drivers/pcmcia: add missing i82365 Wolfgang Denk
2008-05-18 22:39             ` [U-Boot-Users] [PATCH 06/17] ds1722: Fix mutliple warnings and errors and active the ssi for SC520 boards Wolfgang Denk
2008-05-18 22:37           ` [U-Boot-Users] [PATCH 05/17] i386/bootm: remove unused var Wolfgang Denk
2008-05-18 22:36         ` [U-Boot-Users] [PATCH 04/17] i386: Fix global_data declaration Wolfgang Denk
2008-05-18 22:30       ` [U-Boot-Users] [PATCH 03/17] example/gitignore: update with all generated examples Wolfgang Denk
2008-05-18 22:28     ` [U-Boot-Users] [PATCH 02/17] examples/eepro100_eeprom: Fix memcpy to return destination pointer Wolfgang Denk
2008-05-18 22:20       ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2008-05-18 23:03         ` Wolfgang Denk
2008-05-19  1:22           ` Jean-Christophe PLAGNIOL-VILLARD
2008-05-19  2:38             ` Jerry Van Baren
2008-05-19  7:51               ` Markus Klotzbücher
2008-05-18 22:21   ` [U-Boot-Users] [PATCH 01/17] example/82559_eeprom: Fix multiple warnings and errors Wolfgang Denk
2008-05-18 22:18 ` [U-Boot-Users] [PATCH 00/17] x86: Fix warning: type qualifiers ignored on function return type Wolfgang Denk
2008-05-18 22:10   ` Jean-Christophe PLAGNIOL-VILLARD
2008-05-18 23:01     ` Wolfgang Denk

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=20080518222019.GC19480@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.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