Commit fa5cecd111d235819a1d807d43216ae459a0dd6f

Authored by Amol Lad
Committed by Andi Kleen
1 parent c0e84b9901

[PATCH] i386: add missing iounmap in i386 hpet clocksource code

ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.

Tested (compilation only):
- using allmodconfig
- making sure the files are compiling without any warning/error due to
new changes

Signed-off-by: Amol Lad <amol@verismonetworks.com>
Signed-off-by: Andi Kleen <ak@suse.de>

Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff

arch/i386/kernel/hpet.c
... ... @@ -34,6 +34,7 @@
34 34 unsigned long hpet_period;
35 35 void __iomem* hpet_base;
36 36 u64 tmp;
  37 + int err;
37 38  
38 39 if (!is_hpet_enabled())
39 40 return -ENODEV;
... ... @@ -61,7 +62,11 @@
61 62 do_div(tmp, FSEC_PER_NSEC);
62 63 clocksource_hpet.mult = (u32)tmp;
63 64  
64   - return clocksource_register(&clocksource_hpet);
  65 + err = clocksource_register(&clocksource_hpet);
  66 + if (err)
  67 + iounmap(hpet_base);
  68 +
  69 + return err;
65 70 }
66 71  
67 72 module_init(init_hpet_clocksource);