Browse Source

fixed some clang-tidy warnings

Malte Veerman 7 years ago
parent
commit
f4a51d140a
3 changed files with 4 additions and 4 deletions
  1. 1 1
      import/src/fan.cpp
  2. 2 2
      import/src/pwmfan.cpp
  3. 1 1
      import/tests/loadertest.cpp

+ 1 - 1
import/src/fan.cpp

@@ -41,7 +41,7 @@ Fan::Fan(uint index, Hwmon *parent) : Sensor(parent, index, parent ? parent->nam
     m_rpmStream(new QTextStream),
     m_rpm(0)
 {
-    if (m_parent && QDir(parent->path()).isReadable())
+    if (m_parent && parent && QDir(parent->path()).isReadable())
     {
         const auto rpmFile = new QFile(parent->path() + "/fan" + QString::number(index) + "_input", this);
 

+ 2 - 2
import/src/pwmfan.cpp

@@ -79,12 +79,12 @@ PwmFan::PwmFan(uint index, Hwmon *parent) : Fan(index, parent),
             if (pwmFile->open(QFile::ReadWrite))
             {
                 m_pwmStream->setDevice(pwmFile);
-                setPwm(m_pwmStream->readAll().toInt(), false);
+                PwmFan::setPwm(m_pwmStream->readAll().toInt(), false);
             }
             else if (pwmFile->open(QFile::ReadOnly))
             {
                 m_pwmStream->setDevice(pwmFile);
-                setPwm(m_pwmStream->readAll().toInt(), false);
+                PwmFan::setPwm(m_pwmStream->readAll().toInt(), false);
             }
             else
             {

+ 1 - 1
import/tests/loadertest.cpp

@@ -139,7 +139,7 @@ void LoaderTest::parseFctempTest()
         QCOMPARE(spy.at(0).at(0).toString(), error);
         QCOMPARE(spy.at(0).at(1).toBool(), critical);
     }
-    else
+    else if (fan)
         QCOMPARE(fan->hasTemp(), true);
 }