public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] board/purple/flash.c: removed unneded test
@ 2010-07-31 14:09 Frans Meulenbroeks
  2010-07-31 17:16 ` Wolfgang Denk
  0 siblings, 1 reply; 7+ messages in thread
From: Frans Meulenbroeks @ 2010-07-31 14:09 UTC (permalink / raw)
  To: u-boot

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;
-- 
1.6.4.2

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

* [U-Boot] [PATCH] board/purple/flash.c: removed unneded test
  2010-07-31 14:09 [U-Boot] [PATCH] board/purple/flash.c: removed unneded test Frans Meulenbroeks
@ 2010-07-31 17:16 ` Wolfgang Denk
  2010-07-31 18:28   ` Frans Meulenbroeks
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Denk @ 2010-07-31 17:16 UTC (permalink / raw)
  To: u-boot

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

-- 
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: wd at denx.de
In accord with UNIX philosophy, Perl gives you enough  rope  to  hang
yourself.              - L. Wall & R. L. Schwartz, _Programming Perl_

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

* [U-Boot] [PATCH] board/purple/flash.c: removed unneded test
  2010-07-31 17:16 ` Wolfgang Denk
@ 2010-07-31 18:28   ` Frans Meulenbroeks
  2010-08-01  8:10     ` [U-Boot] [PATCH] board/purple/flash.c: removed unneded variable Frans Meulenbroeks
  0 siblings, 1 reply; 7+ messages in thread
From: Frans Meulenbroeks @ 2010-07-31 18:28 UTC (permalink / raw)
  To: u-boot

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.

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

* [U-Boot] [PATCH] board/purple/flash.c: removed unneded variable
  2010-07-31 18:28   ` Frans Meulenbroeks
@ 2010-08-01  8:10     ` Frans Meulenbroeks
  2010-08-01  9:01       ` Sergei Shtylyov
  2010-08-08 23:08       ` Wolfgang Denk
  0 siblings, 2 replies; 7+ messages in thread
From: Frans Meulenbroeks @ 2010-08-01  8:10 UTC (permalink / raw)
  To: u-boot

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;
 }
 
 /*-----------------------------------------------------------------------
-- 
1.6.4.2

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

* [U-Boot] [PATCH] board/purple/flash.c: removed unneded variable
  2010-08-01  8:10     ` [U-Boot] [PATCH] board/purple/flash.c: removed unneded variable Frans Meulenbroeks
@ 2010-08-01  9:01       ` Sergei Shtylyov
  2010-08-01 11:31         ` Frans Meulenbroeks
  2010-08-08 23:08       ` Wolfgang Denk
  1 sibling, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2010-08-01  9:01 UTC (permalink / raw)
  To: u-boot

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

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

* [U-Boot] [PATCH] board/purple/flash.c: removed unneded variable
  2010-08-01  9:01       ` Sergei Shtylyov
@ 2010-08-01 11:31         ` Frans Meulenbroeks
  0 siblings, 0 replies; 7+ messages in thread
From: Frans Meulenbroeks @ 2010-08-01 11:31 UTC (permalink / raw)
  To: u-boot

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

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

* [U-Boot] [PATCH] board/purple/flash.c: removed unneded variable
  2010-08-01  8:10     ` [U-Boot] [PATCH] board/purple/flash.c: removed unneded variable Frans Meulenbroeks
  2010-08-01  9:01       ` Sergei Shtylyov
@ 2010-08-08 23:08       ` Wolfgang Denk
  1 sibling, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2010-08-08 23:08 UTC (permalink / raw)
  To: u-boot

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

-- 
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: wd at denx.de
Microsoft Compatibility:
     your old Windows 3.11 application crash exactly as the new ones.

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

end of thread, other threads:[~2010-08-08 23:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-31 14:09 [U-Boot] [PATCH] board/purple/flash.c: removed unneded test Frans Meulenbroeks
2010-07-31 17:16 ` Wolfgang Denk
2010-07-31 18:28   ` Frans Meulenbroeks
2010-08-01  8:10     ` [U-Boot] [PATCH] board/purple/flash.c: removed unneded variable Frans Meulenbroeks
2010-08-01  9:01       ` Sergei Shtylyov
2010-08-01 11:31         ` Frans Meulenbroeks
2010-08-08 23:08       ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox