mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Pei Xiao <xiaopei01@kylinos.cn>
Cc: dlemoal@kernel.org, linux-ide@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] ata: pata_parport: fix parport attach idr_alloc for
Date: Tue, 22 Sep 2026 16:55:54 +0200	[thread overview]
Message-ID: <arKW-l9NeFy-WT58@ryzen> (raw)
In-Reply-To: <cee1a15d98cd0d55f41fd65ca9d222b68a74e7d3.1790047457.git.xiaopei01@kylinos.cn>

On Tue, Sep 22, 2026 at 11:38:01AM +0800, Pei Xiao wrote:
> 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 <xiaopei01@kylinos.cn>
> ---
>  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 046ab7e3adbc..6f4e3f47d63e 100644
> --- a/drivers/ata/pata_parport/pata_parport.c
> +++ b/drivers/ata/pata_parport/pata_parport.c
> @@ -727,7 +727,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);

This patch looks correct to me.


Kind regards,
Niklas

  reply	other threads:[~2026-09-22 14:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22  3:37 [PATCH v3 0/2] some fixes in pata_parport Pei Xiao
2026-09-22  3:38 ` [PATCH v3 1/2] ata: pata_parport: pin the protocol module before device_register() Pei Xiao
2026-09-22 14:53   ` Niklas Cassel
2026-09-23  1:17     ` Pei Xiao
2026-09-22  3:38 ` [PATCH v3 2/2] ata: pata_parport: fix parport attach idr_alloc for Pei Xiao
2026-09-22 14:55   ` Niklas Cassel [this message]
2026-09-22 14:56 ` (subset) [PATCH v3 0/2] some fixes in pata_parport Niklas Cassel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=arKW-l9NeFy-WT58@ryzen \
    --to=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiaopei01@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®