From: Wolfgang Denk Date: Mon, 19 May 2008 00:28:46 +0200 Subject: [U-Boot-Users] [PATCH 02/17] examples/eepro100_eeprom: Fix memcpy to return destination pointer In-Reply-To: Your message of "Sun, 18 May 2008 19:09:44 +0200." <1211130599-28289-3-git-send-email-plagnioj@jcrosoft.com> Message-ID: <20080518222846.4846D2476E@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de In message <1211130599-28289-3-git-send-email-plagnioj@jcrosoft.com> you wrote: > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD > --- > 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. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de On my planet, to rest is to rest -- to cease using energy. To me, it is quite illogical to run up and down on green grass, using energy, instead of saving it. -- Spock, "Shore Leave", stardate 3025.2