Skip to content

Commit

Permalink
ata: pata_legacy: make legacy_exit() work again
Browse files Browse the repository at this point in the history
Commit defc9cd ("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: defc9cd ("pata_legacy: resychronize with upstream changes and resubmit")
Cc: stable@vger.kernel.org
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
  • Loading branch information
Sergey Shtylyov authored and Damien Le Moal committed May 6, 2024
1 parent 9e6938e commit d4a8933
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/ata/pata_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ static int legacy_port[NR_HOST] = { 0x1f0, 0x170, 0x1e8, 0x168, 0x1e0, 0x160 };
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
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit d4a8933

Please sign in to comment.