Skip to content

Commit

Permalink
NFC: trf7970a: fix check of clock frequencies, use && instead of ||
Browse files Browse the repository at this point in the history
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: 837eb4d ("NFC: trf7970a: add device tree option for 27MHz clock")
Signed-off-by: Colin Ian King <[email protected]>
Acked-by: Geoff Lansberry <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
Colin Ian King authored and Samuel Ortiz committed Jun 22, 2017
1 parent 1e4179b commit e103853
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/nfc/trf7970a.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
dev_err(trf->dev,
"clock-frequency (%u Hz) unsupported\n", clk_freq);
Expand Down

0 comments on commit e103853

Please sign in to comment.