Skip to contentSkip to conversation

SuperH IrDA: correct Baud rate error correction

PATCH In review Nicolas Kaiser 3 participants 3 messages Nov 19, 2010

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

PATCH 1/1 SuperH IrDA: correct Baud rate error correction

It looks to me as if the second value of rate_err_array is intended to be a decimal 625. However, with a leading 0 it becomes an octal constant, and as such evaluates to a decimal 405.

---
 drivers/net/irda/sh_sir.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/irda/sh_sir.c +1 -1
index 00b38bc..52a7c86 100644
@@ -258,7 +258,7 @@ static int sh_sir_set_baudrate(struct sh_sir_self *self, u32 baudrate)
 
 	/* Baud Rate Error Correction x 10000 */
 	u32 rate_err_array[] = {
-		0000, 0625, 1250, 1875,
+		   0,  625, 1250, 1875,
 		2500, 3125, 3750, 4375,
 		5000, 5625, 6250, 6875,
 		7500, 8125, 8750, 9375,
Signature · 1 line
1.7.2.2
#1 lore raw

drivers/net/irda/sh_sir.c static int sh_sir_set_baudrate(struct sh_sir_self *self, u32 baudrate) · line 264

Quoted 6 lines · On Fri, 19 Nov 2010 01:24:02 +0100 Nicolas Kaiser <[email protected]> wrote:
drivers/net/irda/sh_sir.c +1 -1
 	u32 rate_err_array[] = {
-		0000, 0625, 1250, 1875,
+		   0,  625, 1250, 1875,
 		2500, 3125, 3750, 4375,
 		5000, 5625, 6250, 6875,
 		7500, 8125, 8750, 9375,

While you are at it make that table const.

#2 lore raw
Quoted 9 lines · Stephen Hemminger

drivers/net/irda/sh_sir.c static int sh_sir_set_baudrate(struct sh_sir_self *self, u32 baudrate) · line 264

Quoted 6 lines · On Fri, 19 Nov 2010 01:24:02 +0100 Nicolas Kaiser <[email protected]> wrote:
drivers/net/irda/sh_sir.c +1 -1
 	u32 rate_err_array[] = {
-		0000, 0625, 1250, 1875,
+		   0,  625, 1250, 1875,
 		2500, 3125, 3750, 4375,
 		5000, 5625, 6250, 6875,
 		7500, 8125, 8750, 9375,

While you are at it make that table const.

Good find Nicolas.

static const might be better still.