public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* Small fix to flashiodev.c
@ 2010-05-14 21:38 Christophe Coutand
  2010-05-15 16:42 ` Jonathan Larmour
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Coutand @ 2010-05-14 21:38 UTC (permalink / raw)
  To: ecos-patches

[-- Attachment #1: Type: text/plain, Size: 144 bytes --]

Code is not executing properly if CYGFUN_IO_FLASH_BLOCK_FROM_FIS is
enable and CYGFUN_IO_FLASH_BLOCK_FROM_DEVOFFSET is disable.

Christophe

[-- Attachment #2: flashiodev --]
[-- Type: application/octet-stream, Size: 1480 bytes --]

# HG changeset patch
# User ccoutand
# Date 1273872518 -7200

diff --git a/packages/io/flash/current/ChangeLog b/packages/io/flash/current/ChangeLog
--- a/packages/io/flash/current/ChangeLog
+++ b/packages/io/flash/current/ChangeLog
@@ -1,3 +1,7 @@
+2010-05-14  Christophe <ccoutand@stmi.com>
+    * src/flashiodev.c: Fix wrong code execution if CYGFUN_IO_FLASH_BLOCK_FROM_FIS
+    is enable and CYGFUN_IO_FLASH_BLOCK_FROM_DEVOFFSET is disable
+
 2010-03-25  Daniel Helgason  <dhelgason@shaw.ca>
 
 	* cdl/io_flash.cdl: Fix "requires" constraint on
diff --git a/packages/io/flash/current/src/flashiodev.c b/packages/io/flash/current/src/flashiodev.c
--- a/packages/io/flash/current/src/flashiodev.c
+++ b/packages/io/flash/current/src/flashiodev.c
@@ -247,13 +247,17 @@
         start = flash_base;
         end = flash_base + size - 1;
         valid = true;
-    } else
+    }
 #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.
-    if ( (name[0] >= '0') && (name[0] <= '9') )
+#ifdef CYGFUN_IO_FLASH_BLOCK_FROM_FIS    
+    else if ( (name[0] >= '0') && (name[0] <= '9') )
+#else
+    if ( (name[0] >= '0') && (name[0] <= '9') )	
+#endif
     {
         cyg_uint32 flashdevno = name[0] - '0';
         int res;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Small fix to flashiodev.c
  2010-05-14 21:38 Small fix to flashiodev.c Christophe Coutand
@ 2010-05-15 16:42 ` Jonathan Larmour
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Larmour @ 2010-05-15 16:42 UTC (permalink / raw)
  To: Christophe Coutand; +Cc: ecos-patches

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-15 16:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-14 21:38 Small fix to flashiodev.c Christophe Coutand
2010-05-15 16:42 ` Jonathan Larmour

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 read-only IMAP folder(s) and NNTP newsgroup(s).