diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2008-04-28 05:16:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:47 -0400 |
commit | 73f20e58b1d586e9f6d3ddc3aad872829aca7743 (patch) | |
tree | cd426ad1186438a0b16ade918e73c0b84c4bbe92 | |
parent | c7a6c4edc74ee5c3d990325fe93b6916f43499f4 (diff) |
FAT_VALID_MEDIA(): remove pointless test
The on-disk media specification field in FAT is only 8-bits, so testing for
<=0xff is pointless, and can generate a "comparison is always true due to
limited range of data type" warning.
While we're there, convert FAT_VALID_MEDIA() into a C function - the present
implementation is buggy: it generates either one or two references to its
argument.
Cc: Frank Seidel <fseidel@suse.de>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/fat/inode.c | 2 | ||||
-rw-r--r-- | include/linux/msdos_fs.h | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 1604a8a5c01f..bf918929e793 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -1215,7 +1215,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, | |||
1215 | */ | 1215 | */ |
1216 | 1216 | ||
1217 | media = b->media; | 1217 | media = b->media; |
1218 | if (!FAT_VALID_MEDIA(media)) { | 1218 | if (!fat_valid_media(media)) { |
1219 | if (!silent) | 1219 | if (!silent) |
1220 | printk(KERN_ERR "FAT: invalid media value (0x%02x)\n", | 1220 | printk(KERN_ERR "FAT: invalid media value (0x%02x)\n", |
1221 | media); | 1221 | media); |
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index 0bca157ddca5..b03b27457413 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h | |||
@@ -58,7 +58,11 @@ | |||
58 | #define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ | 58 | #define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ |
59 | 59 | ||
60 | /* media of boot sector */ | 60 | /* media of boot sector */ |
61 | #define FAT_VALID_MEDIA(x) ((0xF8 <= (x) && (x) <= 0xFF) || (x) == 0xF0) | 61 | static inline int fat_valid_media(u8 media) |
62 | { | ||
63 | return 0xf8 <= media || media == 0xf0; | ||
64 | } | ||
65 | |||
62 | #define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \ | 66 | #define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \ |
63 | MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x)) | 67 | MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x)) |
64 | 68 | ||