This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Re: Small fix to flashiodev.c
- From: Jonathan Larmour <jifl at jifvik dot org>
- To: Christophe Coutand <ccoutand at stmi dot com>
- Cc: ecos-patches at ecos dot sourceware dot org
- Date: Sat, 15 May 2010 17:42:37 +0100
- Subject: Re: Small fix to flashiodev.c
- References: <D6050C555CC56940A7AF32652283027602E2935F@mail2.STMIRV01.COM>
Christophe Coutand wrote:
Code is not executing properly if CYGFUN_IO_FLASH_BLOCK_FROM_FIS is
enable and CYGFUN_IO_FLASH_BLOCK_FROM_DEVOFFSET is disable.
Good catch, thanks for the patch! I've simplified it a little, and so
checked in the below.
Jifl
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/ChangeLog,v
retrieving revision 1.51
diff -u -5 -p -r1.51 ChangeLog
--- ChangeLog 20 Feb 2009 22:06:15 -0000 1.51
+++ ChangeLog 15 May 2010 16:40:34 -0000
@@ -1,5 +1,11 @@
+2010-05-15 Christophe Coutand <ccoutand@stmi.com>
+
+ * src/flashiodev.c (flashiodev_lookup): Fix wrong code execution if
+ CYGFUN_IO_FLASH_BLOCK_FROM_FIS is enabled and
+ CYGFUN_IO_FLASH_BLOCK_FROM_DEVOFFSET is disabled.
+
2009-02-20 Jonathan Larmour <jifl@eCosCentric.com>
* include/flash.h: Reinstate printf arg to cyg_flash_init, but it
will now be officially required to be set to NULL.
* src/flash.c (cyg_flash_init): Act on printf arg again (even though
Index: src/flashiodev.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/src/flashiodev.c,v
retrieving revision 1.12
diff -u -5 -p -r1.12 flashiodev.c
--- src/flashiodev.c 20 Feb 2009 22:06:15 -0000 1.12
+++ src/flashiodev.c 15 May 2010 16:40:34 -0000
@@ -245,11 +245,14 @@ flashiodev_lookup(struct cyg_devtab_entr
&size))
return -ENODEV; // If the previous call worked, then this
failing would be very wrong.
start = flash_base;
end = flash_base + size - 1;
valid = true;
- } else
+ }
+# ifdef CYGFUN_IO_FLASH_BLOCK_FROM_DEVOFFSET
+ else
+# endif
#endif // ifdef CYGFUN_IO_FLASH_BLOCK_FROM_FIS
#ifdef CYGFUN_IO_FLASH_BLOCK_FROM_DEVOFFSET
// Next, support device numbers with offsets encoded in path name
// Note that for now we assume < 10 flash devices. I think this is
reasonable
// to avoid unnecessary code. It can be changed later if needed.
--
------["The best things in life aren't things."]------ Opinions==mine