Skip to contentSkip to conversation

mpc85xx/T104xRDB: Remove vbank check redundant code

PATCH New Priyanka Jain 2 participants 4 messages May 18, 2015 – Jul 29, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpc85xx/T104xRDB: Remove vbank check redundant code

sw variable in checkboard function is storing vbank value which can only take 4-bit value.
So check of sw value for if greater than 7 is redundant.

---
 board/freescale/t104xrdb/t104xrdb.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
board/freescale/t104xrdb/t104xrdb.c +1 -4
index 9cd5e15..c34eea6 100644
@@ -35,10 +35,7 @@ int checkboard(void)
 	sw = CPLD_READ(flash_ctl_status);
 	sw = ((sw & CPLD_LBMAP_MASK) >> CPLD_LBMAP_SHIFT);
 
-	if (sw <= 7)
-		printf("vBank: %d\n", sw);
-	else
-		printf("Unsupported Bank=%x\n", sw);
+	printf("vBank: %d\n", sw);
 
 	return 0;
 }
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/1 mpc85xx/T104xRDB: Remove vbank check redundant code

Quoted 16 lines · Priyanka Jain

sw variable in checkboard function is storing vbank value which can only take 4-bit value.
So check of sw value for if greater than 7 is redundant.

---
 board/freescale/t104xrdb/t104xrdb.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
board/freescale/t104xrdb/t104xrdb.c +0 -0
index 9cd5e15..c34eea6 100644
@@ -35,10 +35,7 @@ int checkboard(void)
 	sw = CPLD_READ(flash_ctl_status);

board/freescale/t104xrdb/t104xrdb.c int checkboard(void) · line 41

Quoted 10 lines
board/freescale/t104xrdb/t104xrdb.c +1 -4
 	sw = ((sw & CPLD_LBMAP_MASK) >> CPLD_LBMAP_SHIFT);
 
-	if (sw <= 7)
-		printf("vBank: %d\n", sw);
-	else
-		printf("Unsupported Bank=%x\n", sw);
+	printf("vBank: %d\n", sw);
 
 	return 0;
 }

Priyanka,

4-bit variable can still have value bigger than 7. Is there other reason you want to remove it?

York

#2 lore raw

PATCH 1/1 mpc85xx/T104xRDB: Remove vbank check redundant code

Quoted 36 lines

-----Original Message-----
From: Sun York-R58495
Sent: Tuesday, July 28, 2015 12:37 AM
To: Jain Priyanka-B32167; u-boot at lists.denx.de
Subject: Re: [PATCH] mpc85xx/T104xRDB: Remove vbank check redundant code

Quoted 24 lines · Priyanka Jain

sw variable in checkboard function is storing vbank value which can only take 4-bit value.
So check of sw value for if greater than 7 is redundant.

---
 board/freescale/t104xrdb/t104xrdb.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
board/freescale/t104xrdb/t104xrdb.c +1 -4
index 9cd5e15..c34eea6 100644
@@ -35,10 +35,7 @@ int checkboard(void)
 	sw = CPLD_READ(flash_ctl_status);
 	sw = ((sw & CPLD_LBMAP_MASK) >> CPLD_LBMAP_SHIFT);
 
-	if (sw <= 7)
-		printf("vBank: %d\n", sw);
-	else
-		printf("Unsupported Bank=%x\n", sw);
+	printf("vBank: %d\n", sw);
 
Quoted 8 lines

board/freescale/t104xrdb/t104xrdb.c int checkboard(void) · line 41

Quoted 3 lines
board/freescale/t104xrdb/t104xrdb.c +0 -0
 	return 0;
 }

Priyanka,

4-bit variable can still have value bigger than 7. Is there other reason you want to remove it?

[Jain Priyanka-B32167] Sorry, Its 3-bit variable. So cannot have value greater than 7. CPLD_LBMAP_MASK is 0x3f and CPLD_LBMAB_SHIFT is of value 3.
So it is basically bits sw[5], sw[4], sw[3].

Quoted 2 lines

York

#3 lore raw

PATCH 1/1 mpc85xx/T104xRDB: Remove vbank check redundant code

Quoted 42 lines · On 07/29/2015 01:31 AM, Jain Priyanka-B32167 wrote:
Quoted 42 lines

-----Original Message-----
From: Sun York-R58495
Sent: Tuesday, July 28, 2015 12:37 AM
To: Jain Priyanka-B32167; u-boot at lists.denx.de
Subject: Re: [PATCH] mpc85xx/T104xRDB: Remove vbank check redundant code

Quoted 17 lines · Priyanka Jain

sw variable in checkboard function is storing vbank value which can only take 4-bit value.
So check of sw value for if greater than 7 is redundant.

---
 board/freescale/t104xrdb/t104xrdb.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
board/freescale/t104xrdb/t104xrdb.c +0 -0
index 9cd5e15..c34eea6 100644
@@ -35,10 +35,7 @@ int checkboard(void)
 	sw = CPLD_READ(flash_ctl_status);

board/freescale/t104xrdb/t104xrdb.c int checkboard(void) · line 41

Quoted 10 lines
board/freescale/t104xrdb/t104xrdb.c +1 -4
 	sw = ((sw & CPLD_LBMAP_MASK) >> CPLD_LBMAP_SHIFT);
 
-	if (sw <= 7)
-		printf("vBank: %d\n", sw);
-	else
-		printf("Unsupported Bank=%x\n", sw);
+	printf("vBank: %d\n", sw);
 
 	return 0;
 }

Priyanka,

Quoted 6 lines
Quoted 2 lines

4-bit variable can still have value bigger than 7. Is there other reason you want to remove it?

[Jain Priyanka-B32167] Sorry, Its 3-bit variable. So cannot have value greater than 7. CPLD_LBMAP_MASK is 0x3f and CPLD_LBMAB_SHIFT is of value 3.
So it is basically bits sw[5], sw[4], sw[3].

If it is 3-bit value, it makes sense. Can you update the commit message?

York