Skip to contentSkip to conversation

m68k: mac_via: use explicitly signed char

PATCH In review Jason A. Donenfeld 2 participants 3 messages Oct 26, 2022 m68k architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m68k: mac_via: use explicitly signed char

The val variable is set to -1 and compared against < 0, which means it's assumed to be signed. However, soon char is to become unsigned tree-wide. So explicitly mark val as signed to that it keeps working the same way.

Cc Geert Uytterhoeven <[email protected]>

---
Geert - Linus asked me to consolidate all of the unsigned-char fixups in one tree. So, unless you plan on taking this for 6.1, I'll queue it up in that tree for 6.2, following your ack. -Jason

 arch/m68k/include/asm/mac_via.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/include/asm/mac_via.h +1 -1
index 1149251ea58d..e37fcbf47926 100644
@@ -269,7 +269,7 @@ extern int via2_scsi_drq_pending(void);
 
 static inline int rbv_set_video_bpp(int bpp)
 {
-	char val = (bpp==1)?0:(bpp==2)?1:(bpp==4)?2:(bpp==8)?3:-1;
+	signed char val = (bpp==1)?0:(bpp==2)?1:(bpp==4)?2:(bpp==8)?3:-1;
 	if (!rbv_present || val<0) return -1;
 	via2[rMonP] = (via2[rMonP] & ~RBV_DEPTH) | val;
 	return 0;
Signature · 1 line
2.38.1
#1 lore raw

Hi Jason,

Quoted 11 lines · Jason A. Donenfeld

The val variable is set to -1 and compared against < 0, which means it's assumed to be signed. However, soon char is to become unsigned tree-wide. So explicitly mark val as signed to that it keeps working the same way.

Cc Geert Uytterhoeven <[email protected]>

---
Geert - Linus asked me to consolidate all of the unsigned-char fixups in one tree. So, unless you plan on taking this for 6.1, I'll queue it up in that tree for 6.2, following your ack. -Jason

Thanks for your patch!

arch/m68k/include/asm/mac_via.h extern int via2_scsi_drq_pending(void); · line 275

Quoted 11 lines
arch/m68k/include/asm/mac_via.h +1 -1
@@ -269,7 +269,7 @@ extern int via2_scsi_drq_pending(void);
 
 static inline int rbv_set_video_bpp(int bpp)
 {
-       char val = (bpp==1)?0:(bpp==2)?1:(bpp==4)?2:(bpp==8)?3:-1;
+       signed char val = (bpp==1)?0:(bpp==2)?1:(bpp==4)?2:(bpp==8)?3:-1;
        if (!rbv_present || val<0) return -1;
        via2[rMonP] = (via2[rMonP] & ~RBV_DEPTH) | val;
        return 0;

LGTM, although this could just use "int" instead.

Upon closer look, this function is not used, and seems to have never been used before. Please just remove it instead.
Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw
Quoted 32 lines · Geert Uytterhoeven

Hi Jason,

Quoted 11 lines · Jason A. Donenfeld

The val variable is set to -1 and compared against < 0, which means it's assumed to be signed. However, soon char is to become unsigned tree-wide. So explicitly mark val as signed to that it keeps working the same way.

Cc Geert Uytterhoeven <[email protected]>

---
Geert - Linus asked me to consolidate all of the unsigned-char fixups in one tree. So, unless you plan on taking this for 6.1, I'll queue it up in that tree for 6.2, following your ack. -Jason

Thanks for your patch!

arch/m68k/include/asm/mac_via.h extern int via2_scsi_drq_pending(void); · line 275

Quoted 11 lines
arch/m68k/include/asm/mac_via.h +1 -1
@@ -269,7 +269,7 @@ extern int via2_scsi_drq_pending(void);
 
 static inline int rbv_set_video_bpp(int bpp)
 {
-       char val = (bpp==1)?0:(bpp==2)?1:(bpp==4)?2:(bpp==8)?3:-1;
+       signed char val = (bpp==1)?0:(bpp==2)?1:(bpp==4)?2:(bpp==8)?3:-1;
        if (!rbv_present || val<0) return -1;
        via2[rMonP] = (via2[rMonP] & ~RBV_DEPTH) | val;
        return 0;

LGTM, although this could just use "int" instead.

Quoted 2 lines

Upon closer look, this function is not used, and seems to have never been used before. Please just remove it instead.

Hah! Nice catch. Okay, will send you a removal patch (for you to take).

Jason