This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
mmap fix in synth flash drivers
- From: Simon Kallweit <simon dot kallweit at intefo dot ch>
- To: eCos Patches List <ecos-patches at ecos dot sourceware dot org>
- Date: Thu, 18 Dec 2008 09:50:21 +0100
- Subject: mmap fix in synth flash drivers
I found a small bug in the synth flash drivers. As I upgraded my system
to 2GB RAM, the synth flash drivers stopped working, as the check of the
mmap return value was wrong. Here is a patch to fix that.
Simon
diff -r 32a1a041569f packages/devs/flash/synth/current/ChangeLog
--- a/packages/devs/flash/synth/current/ChangeLog Thu Dec 18 09:34:13 2008 +0100
+++ b/packages/devs/flash/synth/current/ChangeLog Thu Dec 18 09:48:30 2008 +0100
@@ -1,3 +1,7 @@
+2008-12-18 Simon Kallweit <simon.kallweit@intefo.ch>
+
+ * src/synth.c: Fixed error check of mmap call.
+
2008-11-19 Simon Kallweit <simon.kallweit@intefo.ch>
* tests/flash2.c: Fixed a few warnings.
diff -r 32a1a041569f packages/devs/flash/synth/current/src/synth.c
--- a/packages/devs/flash/synth/current/src/synth.c Thu Dec 18 09:34:13 2008 +0100
+++ b/packages/devs/flash/synth/current/src/synth.c Thu Dec 18 09:48:30 2008 +0100
@@ -124,9 +124,9 @@
|CYG_HAL_SYS_MAP_FIXED
#endif
, cyg_dev_flash_synth_flashfd, 0 );
- CYG_ASSERT( cyg_dev_flash_synth_base > 0, "mmap of flash file failed!" );
+ CYG_ASSERT( cyg_dev_flash_synth_base != (void *) -1, "mmap of flash file failed!" );
- if (cyg_dev_flash_synth_base <= 0) {
+ if (cyg_dev_flash_synth_base == (void *) -1) {
return FLASH_ERR_HWR;
}
flash_info.start = cyg_dev_flash_synth_base;
diff -r 32a1a041569f packages/devs/flash/synthv2/current/ChangeLog
--- a/packages/devs/flash/synthv2/current/ChangeLog Thu Dec 18 09:34:13 2008 +0100
+++ b/packages/devs/flash/synthv2/current/ChangeLog Thu Dec 18 09:48:30 2008 +0100
@@ -1,3 +1,7 @@
+2008-12-18 Simon Kallweit <simon.kallweit@intefo.ch>
+
+ * src/synth.c: Fixed error check of mmap call.
+
2008-11-28 Sergei Gavrikov <sergei.gavrikov@gmail.com>
* tests/flash[23].c: Fixed copy'n'paste typos in a naming: flash1 ->
diff -r 32a1a041569f packages/devs/flash/synthv2/current/src/synth.c
--- a/packages/devs/flash/synthv2/current/src/synth.c Thu Dec 18 09:34:13 2008 +0100
+++ b/packages/devs/flash/synthv2/current/src/synth.c Thu Dec 18 09:48:30 2008 +0100
@@ -120,8 +120,8 @@
flags,
priv->flashfd,
0l);
- CYG_ASSERT( (int) base > 0, "mmap of flash file failed!" );
- if (base <= 0) {
+ CYG_ASSERT( base != -1, "mmap of flash file failed!" );
+ if (base == -1) {
return CYG_FLASH_ERR_HWR;
}
dev->start = base;