Skip to content

Commit 9dbf5f5

Browse files
haukelinvjw
authored andcommitted
bcma: add missing iounmap on error path
This should fix the problem reported by Fengguang: The coccinelle static checker emits these warnings: drivers/bcma/scan.c:466:3-9: ERROR: missing iounmap; ioremap on line 451 and execution via conditional on line 465 drivers/bcma/scan.c:540:3-9: ERROR: missing iounmap; ioremap on line 515 and execution via conditional on line 539 Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent d8f1bd2 commit 9dbf5f5

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

‎drivers/bcma/scan.c‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,10 @@ int bcma_bus_scan(struct bcma_bus *bus)
462462
while (eromptr < eromend) {
463463
struct bcma_device *other_core;
464464
struct bcma_device *core = kzalloc(sizeof(*core), GFP_KERNEL);
465-
if (!core)
466-
return -ENOMEM;
465+
if (!core) {
466+
err = -ENOMEM;
467+
goto out;
468+
}
467469
INIT_LIST_HEAD(&core->list);
468470
core->bus = bus;
469471

@@ -478,7 +480,7 @@ int bcma_bus_scan(struct bcma_bus *bus)
478480
} else if (err == -ESPIPE) {
479481
break;
480482
}
481-
return err;
483+
goto out;
482484
}
483485

484486
core->core_index = core_num++;
@@ -494,10 +496,12 @@ int bcma_bus_scan(struct bcma_bus *bus)
494496
list_add_tail(&core->list, &bus->cores);
495497
}
496498

499+
err = 0;
500+
out:
497501
if (bus->hosttype == BCMA_HOSTTYPE_SOC)
498502
iounmap(eromptr);
499503

500-
return 0;
504+
return err;
501505
}
502506

503507
int __init bcma_bus_scan_early(struct bcma_bus *bus,
@@ -537,7 +541,7 @@ int __init bcma_bus_scan_early(struct bcma_bus *bus,
537541
else if (err == -ESPIPE)
538542
break;
539543
else if (err < 0)
540-
return err;
544+
goto out;
541545

542546
core->core_index = core_num++;
543547
bus->nr_cores++;
@@ -551,6 +555,7 @@ int __init bcma_bus_scan_early(struct bcma_bus *bus,
551555
break;
552556
}
553557

558+
out:
554559
if (bus->hosttype == BCMA_HOSTTYPE_SOC)
555560
iounmap(eromptr);
556561

0 commit comments

Comments
 (0)