From e1038535106e73e48204ec3bfe5a428fe6cb35cb Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Mon, 24 Apr 2017 14:36:02 +0100 Subject: 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: 837eb4d21ecde7 ("NFC: trf7970a: add device tree option for 27MHz clock") Signed-off-by: Colin Ian King Acked-by: Geoff Lansberry Signed-off-by: Samuel Ortiz --- drivers/nfc/trf7970a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/nfc') diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c index 28b942ea15fb..914463a0e7b3 100644 --- a/drivers/nfc/trf7970a.c +++ b/drivers/nfc/trf7970a.c @@ -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); -- cgit v1.2.3-55-g7522