2.1.82: ide-cd.c warning

Mike Black (mblack@csihq.com)
Tue, 27 Jan 1998 09:37:51 -0500


gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2 -fom
it-frame-pointer -pipe -fno-strength-reduce -m486 -malig
n-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586 -c -o ide-cd.o
ide-cd.c
ide-cd.c: In function `cdrom_analyze_sense_data':
ide-cd.c:275: warning: comparison is always 1 due to limited range of data
type
gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2 -fom
it-frame-p

275:
if (reqbuf->sense_key >= 0 &&
reqbuf->sense_key < ARY_LEN (sense_key_texts))

sense_key is:

unsigned char sense_key : 4;

Should the code be (to force it to an int):

if (reqbuf->sense_key & 0x0f >= 0 &&
reqbuf->sense_key < ARY_LEN (sense_key_texts))

This does clear up the warning.