[U-Boot] [PATCH] Don't tftp to unknown flash

2008-09-01 Thread Jochen Friedrich
If a board has a variable number of flash banks, there are empty entries
in flash_info[] and CFG_DIRECT_FLASH_TFTP is set, tftp boot fails with
Outside available Flash. This patch skips flash banks with unknown
flash ids.

Signed-off-by: Jochen Friedrich [EMAIL PROTECTED]
---
 net/tftp.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/tftp.c b/net/tftp.c
index 84d83ca..5fbcbc3 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -111,7 +111,8 @@ store_block (unsigned block, uchar * src, unsigned len)

for (i=0; iCFG_MAX_FLASH_BANKS; i++) {
/* start address in flash? */
-   if (load_addr + offset = flash_info[i].start[0]) {
+   if ((flash_info[i].flash_id != FLASH_UNKNOWN) 
+   (load_addr + offset = flash_info[i].start[0])) {
rc = 1;
break;
}
-- 
1.5.6.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Don't tftp to unknown flash

2008-09-01 Thread Wolfgang Denk
Dear Jochen Friedrich,

In message [EMAIL PROTECTED] you wrote:
 If a board has a variable number of flash banks, there are empty entries
 in flash_info[] and CFG_DIRECT_FLASH_TFTP is set, tftp boot fails with
 Outside available Flash. This patch skips flash banks with unknown
 flash ids.
 
 Signed-off-by: Jochen Friedrich [EMAIL PROTECTED]
 ---
  net/tftp.c |3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
 
 diff --git a/net/tftp.c b/net/tftp.c
 index 84d83ca..5fbcbc3 100644
 --- a/net/tftp.c
 +++ b/net/tftp.c
 @@ -111,7 +111,8 @@ store_block (unsigned block, uchar * src, unsigned len)
 
   for (i=0; iCFG_MAX_FLASH_BANKS; i++) {
   /* start address in flash? */
 - if (load_addr + offset = flash_info[i].start[0]) {
 + if ((flash_info[i].flash_id != FLASH_UNKNOWN) 
 + (load_addr + offset = flash_info[i].start[0])) {
   rc = 1;
   break;

I think the code would be easier to read if you split this off  in  a
separate test, i. e.:

for (i=0; iCFG_MAX_FLASH_BANKS; i++) {
/* start address in flash? */
if (flash_info[i].flash_id != FLASH_UNKNOWN)
continue;
if (load_addr + offset = flash_info[i].start[0]) {
...
}

Would you please resubmit, if you agree?

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: [EMAIL PROTECTED]
Tactical? TACTICAL!?!? Hey, buddy, we went from kilotons to  megatons
several  minutes  ago.  We don't need no stinkin' tactical nukes. (By
the way, do you have change for 10 million people?)   - lwall
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot