[U-Boot] [PATCH] board/purple/flash.c: removed unneded test

removed part of a test which tested for a var that did not change within the loop and hence was superfluous
Signed-off-by: Frans Meulenbroeks fransmeulenbroeks@gmail.com --- board/purple/flash.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/board/purple/flash.c b/board/purple/flash.c index 37c7bec..299171d 100644 --- a/board/purple/flash.c +++ b/board/purple/flash.c @@ -490,7 +490,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) last = get_timer(0);
/* Start erase on unprotected sectors */ - for (sect = s_first; sect<=s_last && rcode == 0; sect++) { + for (sect = s_first; sect<=s_last; sect++) {
if (info->protect[sect] != 0) /* protected, skip it */ continue;

Dear Frans Meulenbroeks,
In message 1280585375-1613-1-git-send-email-fransmeulenbroeks@gmail.com you wrote:
removed part of a test which tested for a var that did not change within the loop and hence was superfluous
Hm... if you check the code, you see that the other "references" to this variable are not exactly making much sense either. And the function does not return any useful error codes.
Looks as if this never was really thought to an end...
If you touch this file, we should throw out rcode completely.
Best regards,
Wolfgang Denk

2010/7/31 Wolfgang Denk wd@denx.de
Dear Frans Meulenbroeks,
In message 1280585375-1613-1-git-send-email-fransmeulenbroeks@gmail.com you wrote:
removed part of a test which tested for a var that did not change within the loop and hence was superfluous
Hm... if you check the code, you see that the other "references" to this variable are not exactly making much sense either. And the function does not return any useful error codes.
Looks as if this never was really thought to an end...
If you touch this file, we should throw out rcode completely.
I can do that, no problem. Actually I noticed that the rest of the code didn't make much sense but at least it does not add to the footprint or execution time. (thinking of it, maybe the code I removed was optimised away anyway).
And as I was unware whether the coding style demanded a return variable. That is why I left it untouched.
Frans.
PS: I have no particular binding with this code. I don't happen to have this hardware. Just saw an optimisation/cleanup opportunity and decided to fix it.

removed a variable that was not used
Signed-off-by: Frans Meulenbroeks fransmeulenbroeks@gmail.com ---
This supersedes 0001-board-purple-flash.c-removed-unneded-test.patch submitted yesterday
board/purple/flash.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/board/purple/flash.c b/board/purple/flash.c index 37c7bec..5cee35e 100644 --- a/board/purple/flash.c +++ b/board/purple/flash.c @@ -448,7 +448,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) FPWV *addr; int flag, prot, sect; ulong start, now, last; - int rcode = 0; FUNCPTR_WR absEntry;
load_cmd(IN_RAM_CMD_WRITE); @@ -490,7 +489,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) last = get_timer(0);
/* Start erase on unprotected sectors */ - for (sect = s_first; sect<=s_last && rcode == 0; sect++) { + for (sect = s_first; sect<=s_last; sect++) {
if (info->protect[sect] != 0) /* protected, skip it */ continue; @@ -523,7 +522,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) }
printf (" done\n"); - return rcode; + return 0; }
/*-----------------------------------------------------------------------

Hello.
Frans Meulenbroeks wrote:
removed a variable that was not used
Signed-off-by: Frans Meulenbroeks fransmeulenbroeks@gmail.com
[...]
diff --git a/board/purple/flash.c b/board/purple/flash.c index 37c7bec..5cee35e 100644 --- a/board/purple/flash.c +++ b/board/purple/flash.c
[...]
@@ -490,7 +489,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) last = get_timer(0);
/* Start erase on unprotected sectors */
- for (sect = s_first; sect<=s_last && rcode == 0; sect++) {
- for (sect = s_first; sect<=s_last; sect++) {
High time to insert space before and after <=...
WBR, Sergei

2010/8/1 Sergei Shtylyov sshtylyov@mvista.com
Hello.
Frans Meulenbroeks wrote:
removed a variable that was not used
Signed-off-by: Frans Meulenbroeks fransmeulenbroeks@gmail.com
[...]
diff --git a/board/purple/flash.c b/board/purple/flash.c
index 37c7bec..5cee35e 100644 --- a/board/purple/flash.c +++ b/board/purple/flash.c
[...]
@@ -490,7 +489,7 @@ int flash_erase (flash_info_t *info, int s_first, int
s_last) last = get_timer(0); /* Start erase on unprotected sectors */
for (sect = s_first; sect<=s_last && rcode == 0; sect++) {
for (sect = s_first; sect<=s_last; sect++) {
High time to insert space before and after <=...
WBR, Sergei
Be my guest :-) I happen to bump onto the variable issue and decided to fix it, but have no binding with this board (I don't even know what kind of board it is, and I have no desire or intention to clean this up)
BTW: if layout is deemed so important I suggest running the code through a prettyprinter/layout program/code beautifier.
Have fun! Frans

Dear Frans Meulenbroeks,
In message 1280650241-7821-1-git-send-email-fransmeulenbroeks@gmail.com you wrote:
removed a variable that was not used
Signed-off-by: Frans Meulenbroeks fransmeulenbroeks@gmail.com
This supersedes 0001-board-purple-flash.c-removed-unneded-test.patch submitted yesterday
board/purple/flash.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
participants (3)
-
Frans Meulenbroeks
-
Sergei Shtylyov
-
Wolfgang Denk