mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
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: 246a1c4c6b ("ata: pata_parport: add driver (PARIDE replacement)")
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Link: https://lore.kernel.org/r/cee1a15d98cd0d55f41fd65ca9d222b68a74e7d3.1790047457.git.xiaopei01@kylinos.cn
Signed-off-by: Niklas Cassel <cassel@kernel.org>
This commit is contained in:
parent
02178d4b69
commit
193f5b84a9
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user