Commit e1038535 authored by Colin Ian King's avatar Colin Ian King Committed by Samuel Ortiz

NFC: trf7970a: fix check of clock frequencies, use && instead of ||

The "or" condition (clk_freq != TRF7970A_27MHZ_CLOCK_FREQUENCY) ||
(clk_freq != TRF7970A_13MHZ_CLOCK_FREQUE) will always be true because
clk_freq cannot be equal to two different values at the same time. Use
the  && operator instead of || to fix this.

Detected by CoverityScan, CID#1430468 ("Constant expression result")

Fixes: 837eb4d2 ("NFC: trf7970a: add device tree option for 27MHz clock")
Signed-off-by: default avatarColin Ian King <>
Acked-by: default avatarGeoff Lansberry <>
Signed-off-by: default avatarSamuel Ortiz <>
parent 1e4179bc
......@@ -2059,7 +2059,7 @@ static int trf7970a_probe(struct spi_device *spi)
of_property_read_u32(np, "clock-frequency", &clk_freq);
if ((clk_freq != TRF7970A_27MHZ_CLOCK_FREQUENCY) ||
if ((clk_freq != TRF7970A_27MHZ_CLOCK_FREQUENCY) &&
(clk_freq != TRF7970A_13MHZ_CLOCK_FREQUENCY)) {
"clock-frequency (%u Hz) unsupported\n", clk_freq);
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