Skip to contentSkip to conversation

sparc: sbus: treat CPU index as integer

PATCH New Jason A. Donenfeld 1 participant 1 message Oct 28, 2022 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc: sbus: treat CPU index as integer

Using a char to fit a CPU index is too small, and assigning -1 to it isn't correct either, since char is sometimes signed and sometimes not. In this case, it's been fine since this driver only works on sparc, but that will soon be changing when chars become unsigned everywhere. So instead, use a normal int type, which matches the int cpu function argument that this is being compared against.

---
DaveM - this is part of the -funsigned-char work I've been accumulating in my unsigned-char branch. If you want to take this as a fix for 6.1, go ahead. Otherwise, Linus asked me to keep the 6.2 unsigned-char patches together in my branch, so I'll take this, pending your Ack. -Jason

 drivers/sbus/char/envctrl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/sbus/char/envctrl.c +2 -2
index 843e830b5f87..ea914a7eaa7f 100644
@@ -363,8 +363,8 @@ static int envctrl_read_cpu_info(int cpu, struct i2c_child_t *pchild,
 				 char mon_type, unsigned char *bufdata)
 {
 	unsigned char data;
-	int i;
-	char *tbl, j = -1;
+	int i, j = -1;
+	char *tbl;
 
 	/* Find the right monitor type and channel. */
 	for (i = 0; i < PCF8584_MAX_CHANNELS; i++) {
Signature · 1 line
2.38.1