[PATCH] gpib: lpvo_usb: rewrite DLE/STX sequence validation using !(A && B) for clarity
From: sunliming
Date: Fri May 15 2026 - 23:13:49 EST
From: sunliming <sunliming@xxxxxxxxxx>
Fix below smatch warnings:
drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c:808 usb_gpib_read() warn: was
&& intended here instead of ||?
Signed-off-by: sunliming <sunliming@xxxxxxxxxx>
---
drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c b/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c
index e6ea9422d6f2..3e09f8226a56 100644
--- a/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c
+++ b/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c
@@ -802,7 +802,7 @@ static int usb_gpib_read(struct gpib_board *board,
if (retval < 0)
goto read_return;
- if (one_char(board, &b) != DLE || one_char(board, &b) != STX) {
+ if (!(one_char(board, &b) == DLE && one_char(board, &b) == STX)) {
dev_err(board->gpib_dev, "wrong <DLE><STX> sequence\n");
retval = -EIO;
goto read_return;
--
2.43.0