Commit 2af47c10 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jens Axboe

floppy: fix harmless clang build warning

clang warns about unusual code in floppy.c that looks like it
was intended to be a bit mask operation, checking for a specific
bit in the UDP->cmos variable (FLOPPY1_TYPE expands to '4' on

drivers/block/floppy.c:3902:17: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
        if (!UDP->cmos && FLOPPY1_TYPE)
                       ^  ~~~~~~~~~~~~
drivers/block/floppy.c:3902:17: note: use '&' for a bitwise operation
        if (!UDP->cmos && FLOPPY1_TYPE)

The check here is redundant anyway, if FLOPPY1_TYPE is zero, then
assigning it to a zero UDP->cmos field does not change anything,
so removing the extra check here has no effect other than shutting
up the warning.

On x86, this will no longer read a hardware register, as the
FLOPPY1_TYPE macro is not expanded if UDP->cmos is already
zero, but the result is the same.

Cc: Robert Elliott <>
Cc: Keith Busch <>
Link: default avatarArnd Bergmann <>
Signed-off-by: default avatarJens Axboe <>
parent f9bc64a0
......@@ -3900,7 +3900,7 @@ static void __init config_types(void)
if (!UDP->cmos)
drive = 1;
if (!UDP->cmos && FLOPPY1_TYPE)
if (!UDP->cmos)
/* FIXME: additional physical CMOS drive detection should go here */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment