Skip to contentSkip to conversation

mach-davinci: signedness bug

PATCH Applied Nicolas Kaiser 3 participants 3 messages Nov 15, 2010 – Nov 19, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mach-davinci: signedness bug

aemif_calc_rate() can return a negative error value, so all the variables that get tested for this value need to be signed.

The maximum bit width of WSETUP(WSETUP_MAX) appears to be 30 bits (0xf << 26). Using a signed instead of an unsigned integer shouldn't make a difference here.

---
 arch/arm/mach-davinci/aemif.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-davinci/aemif.c +1 -1
index 9c3f500..1ce70a9 100644
@@ -90,7 +90,7 @@ int davinci_aemif_setup_timing(struct davinci_aemif_timing *t,
 					void __iomem *base, unsigned cs)
 {
 	unsigned set, val;
-	unsigned ta, rhold, rstrobe, rsetup, whold, wstrobe, wsetup;
+	int ta, rhold, rstrobe, rsetup, whold, wstrobe, wsetup;
 	unsigned offset = A1CR_OFFSET + cs * 4;
 	struct clk *aemif_clk;
 	unsigned long clkrate;
Signature · 1 line
1.7.2.2
Acked-by on v1 1/1
#1 lore raw

Hi Nicolas,

Quoted 8 lines · Nicolas Kaiser

aemif_calc_rate() can return a negative error value, so all the variables that get tested for this value need to be signed.

The maximum bit width of WSETUP(WSETUP_MAX) appears to be 30 bits (0xf << 26). Using a signed instead of an unsigned integer shouldn't make a difference here.

Thanks for the fix. You could use the subject:

"davinci: signedness bug in davinci_aemif_setup_timing()"

Other than that:

Thanks,
Sekhar

Quoted 20 lines
---
 arch/arm/mach-davinci/aemif.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-davinci/aemif.c +1 -2
index 9c3f500..1ce70a9 100644
@@ -90,7 +90,7 @@ int davinci_aemif_setup_timing(struct davinci_aemif_timing *t,
                                      void __iomem *base, unsigned cs)
 {
      unsigned set, val;
-     unsigned ta, rhold, rstrobe, rsetup, whold, wstrobe, wsetup;
+     int ta, rhold, rstrobe, rsetup, whold, wstrobe, wsetup;
      unsigned offset = A1CR_OFFSET + cs * 4;
      struct clk *aemif_clk;
      unsigned long clkrate;
--

1.7.2.2

Applied
#2 lore raw
Quoted 12 lines · Sekhar

Hi Nicolas,

Quoted 8 lines · Nicolas Kaiser

aemif_calc_rate() can return a negative error value, so all the variables that get tested for this value need to be signed.

The maximum bit width of WSETUP(WSETUP_MAX) appears to be 30 bits (0xf << 26). Using a signed instead of an unsigned integer shouldn't make a difference here.

Quoted 7 lines

Thanks for the fix. You could use the subject:

"davinci: signedness bug in davinci_aemif_setup_timing()"

Other than that:

Thanks, I fixed up the subject as Sekhar suggested.

Applied, queuing for 2.6.38.

Kevin