From patchwork Fri May 2 11:12:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 886892 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [195.130.132.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B264242D8B for ; Fri, 2 May 2025 11:12:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746184366; cv=none; b=VlqX0mac57Xr33My8jAcAmK+E8H5sRKA5zcfDGBRL0QfrWeCKJS3XkY4qhm/H/4xYeihLFiW9nVhEfvWPNL7NPoRF65pFTtPYDaTl00myFGBZhqJjKYJ4Yr3XKeXPeT4aVVwux0y/U9Kq1fkx+ykGM/Vk8qZ0Xa5G5OJOGLrAhM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746184366; c=relaxed/simple; bh=FoHKU1Quq43ue6Mq6k+L3exih1jgftn8flH0qo/BRfQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gE+lCu4oVBRa8uVZmoh5gKlv1aM8gyQsiV90KtHrjfqDowoYX5CTc+UJkwm2PZcYIWP/KXIDh/rh2SzFY7oN8iJWFqi8YbzOx8YH366fUPXk09HWoOvGm1r4wtqzHv58QI5DNT6i9DqCN6qw/FS+I788mCGl4lReJxlpFXCfLNA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.132.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:df64:35e8:502:4ac0]) by xavier.telenet-ops.be with cmsmtp id kBCg2E00E4sst1101BCgAd; Fri, 02 May 2025 13:12:40 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.97) (envelope-from ) id 1uAoJn-00000000WaP-3vTS; Fri, 02 May 2025 13:12:40 +0200 Received: from geert by rox.of.borg with local (Exim 4.97) (envelope-from ) id 1uAoJs-00000008p3y-1gk2; Fri, 02 May 2025 13:12:40 +0200 From: Geert Uytterhoeven To: Mark Brown , Martin Sperl Cc: linux-spi@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] spi: loopback-test: Simplify strange loopback value check Date: Fri, 2 May 2025 13:12:39 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Apply De Morgan's Theorem and drop superfluous parentheses to simplify the check for strange loopback values. While at it, add the missing zero in the related comment. Signed-off-by: Geert Uytterhoeven --- drivers/spi/spi-loopback-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c index 7740f94847a883f3..a8a6e80c782e2592 100644 --- a/drivers/spi/spi-loopback-test.c +++ b/drivers/spi/spi-loopback-test.c @@ -635,8 +635,8 @@ static int spi_test_check_loopback_result(struct spi_device *spi, } else { /* first byte received */ txb = ((u8 *)xfer->rx_buf)[0]; - /* first byte may be 0 or xff */ - if (!((txb == 0) || (txb == 0xff))) { + /* first byte may be 0 or 0xff */ + if (txb != 0 && txb != 0xff) { dev_err(&spi->dev, "loopback strangeness - we expect 0x00 or 0xff, but not 0x%02x\n", txb);