From a8b472598ebc7874651a92f6342c714c37b0f083 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 12 Aug 2019 14:02:06 +0300 Subject: hal: Fix comparison of unsigned integer < 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CameraHalManager::getCameraInfo() validates the camera id it receives from the camera service, and in doing so generates a compiler error with gcc as the id is an unsigned integer and can never be negative: ../src/android/camera_hal_manager.cpp: In member function ‘CameraProxy* CameraHalManager::open(unsigned int, const hw_module_t*)’: ../src/android/camera_hal_manager.cpp:89:9: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] if (id < 0 || id >= numCameras()) { Fix it by removing the unneeded comparison. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/android/camera_hal_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp index 1e66f632..37ba0135 100644 --- a/src/android/camera_hal_manager.cpp +++ b/src/android/camera_hal_manager.cpp @@ -86,7 +86,7 @@ void CameraHalManager::run() CameraProxy *CameraHalManager::open(unsigned int id, const hw_module_t *hardwareModule) { - if (id < 0 || id >= numCameras()) { + if (id >= numCameras()) { LOG(HAL, Error) << "Invalid camera id '" << id << "'"; return nullptr; } -- cgit v1.2.1