Skip to contentSkip to conversation

ALSA: usb-audio: silence a static checker warning

PATCH In review Dan Carpenter 2 participants 2 messages Mar 29, 2018

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

PATCH 1/1 ALSA: usb-audio: silence a static checker warning

We recently made "format" a u64 variable so now static checkers complain that this shift will wrap around if format is more than 31. I don't think it makes a difference for runtime, but it's simple to silence the warning.

sound/usb/format.c +1 -1
index edbe67eeddfa..49e7ec6d2399 100644
@@ -55,7 +55,7 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
 		struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
 		sample_width = fmt->bBitResolution;
 		sample_bytes = fmt->bSubframeSize;
-		format = 1 << format;
+		format = 1ULL << format;
 		break;
 	}
 
#1 lore raw
Quoted 7 lines · Dan Carpenter

We recently made "format" a u64 variable so now static checkers complain that this shift will wrap around if format is more than 31. I don't think it makes a difference for runtime, but it's simple to silence the warning.

Applied now. Thanks.

Takashi