diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 52b9e98ea..b9b27e1c7 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -27,5 +27,6 @@ # Please keep the list sorted. Marc-Antoine Ruel +Matias Insaurralde Stephan Sperber Thorsten von Eicken diff --git a/conn/spi/spismoketest/spismoketest.go b/conn/spi/spismoketest/spismoketest.go index 20a4c9864..1ffa0eb90 100644 --- a/conn/spi/spismoketest/spismoketest.go +++ b/conn/spi/spismoketest/spismoketest.go @@ -77,11 +77,7 @@ func (s *SmokeTest) Run(args []string) error { log.Printf("%s: random number seed %d", s, *seed) // Run the tests. - if err := s.eeprom(spiDev, wpPin); err != nil { - return err - } - - return nil + return s.eeprom(spiDev, wpPin) } // eeprom tests a 5080 8Kbit serial EEPROM attached to the SPI bus. diff --git a/devices/lepton/lepton.go b/devices/lepton/lepton.go index 384dbc6b6..621709674 100644 --- a/devices/lepton/lepton.go +++ b/devices/lepton/lepton.go @@ -159,7 +159,7 @@ func (d *Dev) ReadImg() (*Frame, error) { if err := d.readFrame(f); err != nil { return nil, err } - if f.Metadata.FFCDesired == true { + if f.Metadata.FFCDesired { // TODO(maruel): Automatically trigger FFC when applicable, only do if // the camera has a shutter. //go d.RunFFC() diff --git a/host/bcm283x/gpio.go b/host/bcm283x/gpio.go index d62d9fff9..2c5259236 100644 --- a/host/bcm283x/gpio.go +++ b/host/bcm283x/gpio.go @@ -600,7 +600,7 @@ func (d *driverGPIO) Init() (bool, error) { return false, errors.New("bcm283x CPU not detected") } model := distro.CPUInfo()["model name"] - if strings.Index(model, "ARMv6") != -1 { + if strings.Contains(model, "ARMv6") { baseAddr = 0x20000000 dramBus = 0x40000000 } else { diff --git a/host/chip/chip.go b/host/chip/chip.go index eba8e8682..26ede783f 100644 --- a/host/chip/chip.go +++ b/host/chip/chip.go @@ -340,11 +340,7 @@ func (d *driver) Init() (bool, error) { {gpioreg.ByName("CSID6"), gpioreg.ByName("CSID7")}, {U14_39, U14_40}, } - if err := pinreg.Register("U14", U14); err != nil { - return true, err - } - - return true, nil + return true, pinreg.Register("U14", U14) } func init() { diff --git a/host/distro/distro.go b/host/distro/distro.go index 7dd40ddce..96e49dfbf 100644 --- a/host/distro/distro.go +++ b/host/distro/distro.go @@ -39,12 +39,10 @@ func IsArmbian() bool { func IsDebian() bool { if isLinux { // http://0pointer.de/public/systemd-man/os-release.html#ID_LIKE= - id, _ := OSRelease()["ID"] - if id == "debian" { + if OSRelease()["ID"] == "debian" { return true } - idLike, _ := OSRelease()["ID_LIKE"] - for _, part := range strings.Split(idLike, " ") { + for _, part := range strings.Split(OSRelease()["ID_LIKE"], " ") { if part == "debian" { return true } @@ -58,8 +56,7 @@ func IsDebian() bool { // https://raspbian.org/ func IsRaspbian() bool { if isArm && isLinux { - id, _ := OSRelease()["ID"] - return id == "raspbian" + return OSRelease()["ID"] == "raspbian" } return false } @@ -69,8 +66,7 @@ func IsRaspbian() bool { // https://ubuntu.com/ func IsUbuntu() bool { if isLinux { - id, _ := OSRelease()["ID"] - return id == "ubuntu" + return OSRelease()["ID"] == "ubuntu" } return false } diff --git a/host/rpi/rpi.go b/host/rpi/rpi.go index 31ec22783..f7049e16d 100644 --- a/host/rpi/rpi.go +++ b/host/rpi/rpi.go @@ -128,7 +128,7 @@ func (d *driver) Init() (bool, error) { // // This code is not futureproof, it will error out on a Raspberry Pi 4 // whenever it comes out. - rev, _ := distro.CPUInfo()["Revision"] + rev := distro.CPUInfo()["Revision"] if i, err := strconv.ParseInt(rev, 16, 32); err == nil { // Ignore the overclock bit. i &= 0xFFFFFF diff --git a/host/sysfs/spi.go b/host/sysfs/spi.go index 41fbe39a6..18b367c0e 100644 --- a/host/sysfs/spi.go +++ b/host/sysfs/spi.go @@ -513,10 +513,7 @@ func (d *driverSPI) Init() (bool, error) { } // Update the global value. spiBufSize, err = strconv.Atoi(strings.TrimSpace(string(b))) - if err != nil { - return true, err - } - return true, nil + return true, err } type openerSPI struct {