mirror of
https://github.com/stianeikeland/go-rpio.git
synced 2025-01-23 10:41:03 +01:00
Merge pull request #17 from Drahoslav7/fix-close-func
Add missing unmap to Close
This commit is contained in:
commit
f6236e5866
6
rpio.go
6
rpio.go
|
@ -500,12 +500,13 @@ func Open() (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Memory map clock reisters to slice
|
// Memory map clock registers to slice
|
||||||
clkMem, clkMem8, err = memMap(file.Fd(), clkBase)
|
clkMem, clkMem8, err = memMap(file.Fd(), clkBase)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Memory map pwm registers to slice
|
||||||
pwmMem, pwmMem8, err = memMap(file.Fd(), pwmBase)
|
pwmMem, pwmMem8, err = memMap(file.Fd(), pwmBase)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -543,6 +544,9 @@ func Close() error {
|
||||||
if err := syscall.Munmap(clkMem8); err != nil {
|
if err := syscall.Munmap(clkMem8); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := syscall.Munmap(pwmMem8); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user