Skip to contentSkip to conversation

irda: Fix likely typo in output format string

PATCH In review Oleg Drokin 3 participants 5 messages Aug 27, 2016 – Aug 31, 2016

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

PATCH 1/1 irda: Fix likely typo in output format string

%ul would print an unsigned with a letter l at the end which does not seem to be desired here, on the other hand the value being printed is u32 so just drop the l instead of converting to %lu

---
 drivers/net/irda/vlsi_ir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/irda/vlsi_ir.c +1 -1
index a0849f4..98308bd 100644
@@ -279,7 +279,7 @@ static void vlsi_proc_ndev(struct seq_file *seq, struct net_device *ndev)
 		(idev->mode==IFF_SIR)?"SIR":((idev->mode==IFF_MIR)?"MIR":"FIR"));
 	sec = div_s64_rem(ktime_us_delta(ktime_get(), idev->last_rx),
 			  USEC_PER_SEC, &usec);
-	seq_printf(seq, "last rx: %ul.%06u sec\n", sec, usec);
+	seq_printf(seq, "last rx: %u.%06u sec\n", sec, usec);
 
 	seq_printf(seq, "RX: packets=%lu / bytes=%lu / errors=%lu / dropped=%lu",
 		ndev->stats.rx_packets, ndev->stats.rx_bytes, ndev->stats.rx_errors,
Signature · 1 line
2.7.4
#1 lore raw

(added Chunyan Zhang to cc)

Quoted 3 lines · Oleg Drokin

%ul would print an unsigned with a letter l at the end which does not seem to be desired here, on the other hand the value being printed is u32 so just drop the l instead of converting to %lu

Fixes 497ec1f2a086 ("irda: vlsi_ir: Replace timeval with ktime_t")

Thanks Oleg

drivers/net/irda/vlsi_ir.c

Quoted 1 line
drivers/net/irda/vlsi_ir.c +0 -0

[]

Quoted 9 lines
drivers/net/irda/vlsi_ir.c +1 -1
@@ -279,7 +279,7 @@ static void vlsi_proc_ndev(struct seq_file *seq, struct net_device *ndev)
  		(idev->mode==IFF_SIR)?"SIR":((idev->mode==IFF_MIR)?"MIR":"FIR"));
  	sec = div_s64_rem(ktime_us_delta(ktime_get(), idev->last_rx),
  			  USEC_PER_SEC, &usec);
-	seq_printf(seq, "last rx: %ul.%06u sec\n", sec, usec);
+	seq_printf(seq, "last rx: %u.%06u sec\n", sec, usec);


  seq_printf(seq, "RX: packets=%lu / bytes=%lu / errors=%lu / dropped=%lu", ndev->stats.rx_packets, ndev->stats.rx_bytes, ndev->stats.rx_errors,

#3 lore raw
Quoted 10 lines · David Miller

From: Oleg Drokin <[email protected]>
Date: Fri, 26 Aug 2016 23:14:06 -0400

Quoted 5 lines

%ul would print an unsigned with a letter l at the end which does not seem to be desired here, on the other hand the value being printed is u32 so just drop the l instead of converting to %lu

%u is for unsigned values, and these are "s32" thus signed.

Hm, you are right.
I could swear I saw them as unsigned when I looked at it.

Anyway can they really be negative? they are seconds and usec, should I change them to u32 too?

maintainer
#4 lore raw

From: Oleg Drokin <[email protected]>
Date: Wed, 31 Aug 2016 17:36:44 -0400

Quoted 12 lines · David Miller
Quoted 10 lines

From: Oleg Drokin <[email protected]>
Date: Fri, 26 Aug 2016 23:14:06 -0400

Quoted 5 lines

%ul would print an unsigned with a letter l at the end which does not seem to be desired here, on the other hand the value being printed is u32 so just drop the l instead of converting to %lu

Quoted 7 lines
Quoted 1 line

%u is for unsigned values, and these are "s32" thus signed.

Hm, you are right.
I could swear I saw them as unsigned when I looked at it.

Anyway can they really be negative? they are seconds and usec, should I change them to u32 too?

If you're interesting in continuing with this, it is your area for exploration not our's :-)