Merge pull request #17 from Drahoslav7/fix-close-func

Add missing unmap to Close
This commit is contained in:
Stian Eikeland 2018-01-15 17:23:40 +01:00 committed by GitHub
commit f6236e5866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -500,12 +500,13 @@ func Open() (err error) {
return
}
// Memory map clock reisters to slice
// Memory map clock registers to slice
clkMem, clkMem8, err = memMap(file.Fd(), clkBase)
if err != nil {
return
}
// Memory map pwm registers to slice
pwmMem, pwmMem8, err = memMap(file.Fd(), pwmBase)
if err != nil {
return
@ -543,6 +544,9 @@ func Close() error {
if err := syscall.Munmap(clkMem8); err != nil {
return err
}
if err := syscall.Munmap(pwmMem8); err != nil {
return err
}
return nil
}