Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: linux-ide@vger.kernel.org, Damien Le Moal <dlemoal@kernel.org>,
	lvc-project@linuxtesting.org
Subject: Re: [PATCH] ata: pata_legacy: make legacy_exit() work again
Date: Mon, 6 May 2024 18:37:37 +0200	[thread overview]
Message-ID: <ZjkHUcfFMXtAmdYS@ryzen.lan> (raw)
In-Reply-To: <c6ad7d07-4dc8-7087-4018-6ebdf93d6580@omp.ru>

On Sat, May 04, 2024 at 11:27:25PM +0300, Sergey Shtylyov wrote:
> Commit defc9cd826e4 ("pata_legacy: resychronize with upstream changes and
> resubmit") missed to update legacy_exit(), so that it now fails to do any
> cleanup -- the loop body there can never be entered.  Fix that and finally
> remove now useless nr_legacy_host variable...
> 
> Found by Linux Verification Center (linuxtesting.org) with the Svace static
> analysis tool.
> 
> Fixes: defc9cd826e4 ("pata_legacy: resychronize with upstream changes and resubmit")
> Cc: stable@vger.kernel.org
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> ---
> This patch is against the master branch of the LibATA Group's linux.git repo.
> It's only been build-tested...
> 
>  drivers/ata/pata_legacy.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> Index: linux/drivers/ata/pata_legacy.c
> ===================================================================
> --- linux.orig/drivers/ata/pata_legacy.c
> +++ linux/drivers/ata/pata_legacy.c
> @@ -173,8 +173,6 @@ static int legacy_port[NR_HOST] = { 0x1f
>  static struct legacy_probe probe_list[NR_HOST];
>  static struct legacy_data legacy_data[NR_HOST];
>  static struct ata_host *legacy_host[NR_HOST];
> -static int nr_legacy_host;
> -
>  
>  /**
>   *	legacy_probe_add	-	Add interface to probe list
> @@ -1276,9 +1274,11 @@ static __exit void legacy_exit(void)
>  {
>  	int i;
>  
> -	for (i = 0; i < nr_legacy_host; i++) {
> +	for (i = 0; i < NR_HOST; i++) {
>  		struct legacy_data *ld = &legacy_data[i];
> -		ata_host_detach(legacy_host[i]);
> +
> +		if (legacy_host[i])
> +			ata_host_detach(legacy_host[i]);
>  		platform_device_unregister(ld->platform_dev);
>  	}
>  }

Reviewed-by: Niklas Cassel <cassel@kernel.org>

  reply	other threads:[~2024-05-06 16:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-04 20:27 [PATCH] ata: pata_legacy: make legacy_exit() work again Sergey Shtylyov
2024-05-06 16:37 ` Niklas Cassel [this message]
2024-05-06 22:28 ` Damien Le Moal

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=ZjkHUcfFMXtAmdYS@ryzen.lan \
    --to=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=s.shtylyov@omp.ru \
    /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