mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] parport: fix inverted daisy selection result check
@ 2026-06-24  1:36 Yang Shao
  2026-07-27  7:00 ` Yang Shao
  0 siblings, 1 reply; 3+ messages in thread
From: Yang Shao @ 2026-06-24  1:36 UTC (permalink / raw)
  To: sudipm.mukherjee
  Cc: marko.kohtala, akpm, linux-kernel, kernel, Yang Shao, stable

parport_daisy_select() returns a boolean success result. It returns 1
when the requested daisy-chain device acknowledges the CPP selection
command and 0 otherwise.

Commit 7c9cc3be1094 ("[PATCH] parport: parport_daisy_select return
value fix") changed the helper from returning the raw
PARPORT_STATUS_ERROR bit to returning its logical negation. Selection
success therefore changed from a zero return value to a nonzero return
value, but parport_claim() retained the old zero-is-success test.

As a result, a successful selection does not update port->daisy, while
an unsuccessful selection can be recorded as the currently selected
daisy address. parport_open() later checks port->daisy to determine
whether the requested device was successfully selected, so this can
reject an existing device or accept a device address that was not
selected.

Test the return value directly and update port->daisy only after a
successful selection.

Fixes: 7c9cc3be1094 ("[PATCH] parport: parport_daisy_select return value fix")
Cc: stable@vger.kernel.org
Signed-off-by: Yang Shao <shaoyang@uniontech.com>
---
 drivers/parport/share.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index c4c5869..2888005 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -1025,8 +1025,8 @@ int parport_claim(struct pardevice *dev)
 	/* If it's a daisy chain device, select it. */
 	if (dev->daisy >= 0) {
 		/* This could be lazier. */
-		if (!parport_daisy_select(port, dev->daisy,
-					   IEEE1284_MODE_COMPAT))
+		if (parport_daisy_select(port, dev->daisy,
+					 IEEE1284_MODE_COMPAT))
 			port->daisy = dev->daisy;
 	}
 #endif /* IEEE1284.3 support */
--
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-27 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-24  1:36 [PATCH] parport: fix inverted daisy selection result check Yang Shao
2026-07-27  7:00 ` Yang Shao
2026-07-27 13:59   ` Marko Kohtala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®