Fix cppcheck warnings

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I18be21d5141630a1da3d5e54740b54a9a06496d9
diff --git a/src/gpio.cpp b/src/gpio.cpp
index 86d4cec..52ffed6 100644
--- a/src/gpio.cpp
+++ b/src/gpio.cpp
@@ -203,14 +203,15 @@
     }
     else if ((gpioDirection == "both"))
     {
-        // Before set gpio configure as an interrupt pin, need to set direction
-        // as 'in' or edge can't set as 'rising', 'falling' and 'both'
-        const char* in_direction = "in";
         devPath = gpioDev + "/gpio" + std::to_string(gpioNum) + "/direction";
 
         stream.open(devPath, std::fstream::out);
         try
         {
+            // Before set gpio configure as an interrupt pin, need to set
+            // direction as 'in' or edge can't set as 'rising', 'falling' and
+            // 'both'
+            const char* in_direction = "in";
             stream << in_direction;
             stream.close();
         }