From 193f5b84a95c02456f51fe5067750ecf73d213d5 Mon Sep 17 00:00:00 2001 From: Pei Xiao Date: Tue, 22 Sep 2026 11:38:01 +0800 Subject: [PATCH] ata: pata_parport: fix parport attach idr_alloc for idr_alloc() expects an inclusive start and an exclusive end, so passing port->number as both arguments produces an empty range. Because idr_alloc() only falls back to INT_MAX when end <= 0, the allocation succeeds solely for parport0 and returns -ENOSPC for every other port, which pata_parport_attach() silently ignores. As a result only parport0 gets probed and any higher-numbered parports are never attached. Use port->number + 1 as the end so the range [port->number, port->number + 1) contains exactly the desired ID. Fixes: 246a1c4c6b7f ("ata: pata_parport: add driver (PARIDE replacement)") Signed-off-by: Pei Xiao Link: https://lore.kernel.org/r/cee1a15d98cd0d55f41fd65ca9d222b68a74e7d3.1790047457.git.xiaopei01@kylinos.cn Signed-off-by: Niklas Cassel --- drivers/ata/pata_parport/pata_parport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_parport/pata_parport.c index cf81a6128f55..f0fe921a10b4 100644 --- a/drivers/ata/pata_parport/pata_parport.c +++ b/drivers/ata/pata_parport/pata_parport.c @@ -723,7 +723,7 @@ static void pata_parport_attach(struct parport *port) int pr_num, id; mutex_lock(&pi_mutex); - id = idr_alloc(&parport_list, port, port->number, port->number, + id = idr_alloc(&parport_list, port, port->number, port->number + 1, GFP_KERNEL); if (id < 0) { mutex_unlock(&pi_mutex);