[PATCH] parport: fix inverted daisy selection result check

From: Yang Shao

Date: Tue Jun 23 2026 - 21:38:30 EST


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@xxxxxxxxxxxxxxx
Signed-off-by: Yang Shao <shaoyang@xxxxxxxxxxxxx>
---
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