Skip to content

Commit d4a8933

Browse files
Sergey Shtylyovdamien-lemoal
authored andcommitted
ata: pata_legacy: make legacy_exit() work again
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: [email protected] Signed-off-by: Sergey Shtylyov <[email protected]> Reviewed-by: Niklas Cassel <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent 9e6938e commit d4a8933

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/ata/pata_legacy.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,6 @@ static int legacy_port[NR_HOST] = { 0x1f0, 0x170, 0x1e8, 0x168, 0x1e0, 0x160 };
173173
static struct legacy_probe probe_list[NR_HOST];
174174
static struct legacy_data legacy_data[NR_HOST];
175175
static struct ata_host *legacy_host[NR_HOST];
176-
static int nr_legacy_host;
177-
178176

179177
/**
180178
* legacy_probe_add - Add interface to probe list
@@ -1276,9 +1274,11 @@ static __exit void legacy_exit(void)
12761274
{
12771275
int i;
12781276

1279-
for (i = 0; i < nr_legacy_host; i++) {
1277+
for (i = 0; i < NR_HOST; i++) {
12801278
struct legacy_data *ld = &legacy_data[i];
1281-
ata_host_detach(legacy_host[i]);
1279+
1280+
if (legacy_host[i])
1281+
ata_host_detach(legacy_host[i]);
12821282
platform_device_unregister(ld->platform_dev);
12831283
}
12841284
}

0 commit comments

Comments
 (0)