thermal: Fix bugprone-use-after-move.
authorJosh Gao <jmgao@google.com>
Wed, 18 Mar 2020 02:27:13 +0000 (19:27 -0700)
committerFrancescodario Cuzzocrea <bosconovic@gmail.com>
Tue, 22 Dec 2020 10:37:02 +0000 (11:37 +0100)
fd was moved out of, so we were adding -1 to the looper.

Bug: http://b/150783499
Test: treehugger

(cherry picked from commit 56ed76601d2fa5f1a1e6f7f24d79975a69f43a39)

Change-Id: Ib571f32078fd9adb91a1e619110330583b75482b

hidl/thermal/utils/thermal_watcher.cpp

index 029821600a58d63d03ea334541838bcf14afe170..08a7e390a859251d574e494560952bcc8bd57c4c 100644 (file)
@@ -47,8 +47,8 @@ void ThermalWatcher::registerFilesToWatch(const std::set<std::string> &sensors_t
             continue;
         }
         watch_to_file_path_map_.emplace(fd.get(), path);
-        fds_.emplace_back(std::move(fd));
         looper_->addFd(fd.get(), 0, Looper::EVENT_INPUT, nullptr, nullptr);
+        fds_.emplace_back(std::move(fd));
     }
     monitored_sensors_.insert(sensors_to_watch.begin(), sensors_to_watch.end());
     if (!uevent_monitor) {