From patchwork Tue Dec 1 17:43:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 10531 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id CE2DEBE177 for ; Tue, 1 Dec 2020 17:43:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9A54B63502; Tue, 1 Dec 2020 18:43:26 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="o/Ed1NHY"; dkim-atps=neutral Received: from mail.uajain.com (static.126.159.217.95.clients.your-server.de [95.217.159.126]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7253663504 for ; Tue, 1 Dec 2020 18:43:24 +0100 (CET) From: Umang Jain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=uajain.com; s=mail; t=1606844603; bh=oRjCMpNIRqSLO/uBfgIa8QnFPiHqODBbal+gfGMUfNA=; h=From:To:Cc:Subject:In-Reply-To:References; b=o/Ed1NHY8mKEVYLioE3WAvbNmAGyoWBm8oMkVP0bwdSP7LFVPBbVUvC74cAt/yUY9 5qG9Rk5Si/8qWPq3x3iTvkKXHD/Gt6xyJC65yLTDy0AlntlJiIuCZ8XuAMtOsSVmfS kICUyLy3DZWNVyMfk7bkGTLOhExaXnVLOW6JQO2s+/NHcEa9QRKQ7d254m5yvtOJqS W9j+vLvXeOI+OsdZ/4qpeemg0Iu6Xv/safl+MC0Z7BC4cvnjCCTJsCnAkd25ptM8jD OnDieR6rRhlW8dqmQecH5fv8/sKxcYDxvg0g+AQsmf2JkiPHo28EUtFHCeAKrqMlpb sRMqvw/ufsbvg== To: libcamera-devel@lists.libcamera.org Date: Tue, 1 Dec 2020 23:13:11 +0530 Message-Id: <20201201174314.12774-2-email@uajain.com> In-Reply-To: <20201201174314.12774-1-email@uajain.com> References: <20201201174314.12774-1-email@uajain.com> Mime-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/4] simple-cam: Make return codes consistent for main() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Use EXIT_FAILURE or EXIT_SUCCESS to indicate program execution status. These are the return codes that should be used for main() as per the C++ standard. Signed-off-by: Umang Jain Reviewed-by: Laurent Pinchart --- simple-cam.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/simple-cam.cpp b/simple-cam.cpp index 727bb6d..e88fb85 100644 --- a/simple-cam.cpp +++ b/simple-cam.cpp @@ -184,7 +184,7 @@ int main() int ret = camera->configure(config.get()); if (ret) { std::cout << "CONFIGURATION FAILED!" << std::endl; - return -1; + return EXIT_FAILURE; } #endif @@ -217,7 +217,7 @@ int main() int ret = allocator->allocate(cfg.stream()); if (ret < 0) { std::cerr << "Can't allocate buffers" << std::endl; - return -ENOMEM; + return EXIT_FAILURE; } unsigned int allocated = allocator->buffers(cfg.stream()).size(); @@ -250,7 +250,7 @@ int main() if (!request) { std::cerr << "Can't create request" << std::endl; - return -ENOMEM; + return EXIT_FAILURE; } const std::unique_ptr &buffer = buffers[i]; @@ -259,7 +259,7 @@ int main() { std::cerr << "Can't set buffer for request" << std::endl; - return ret; + return EXIT_FAILURE; } /* @@ -341,5 +341,5 @@ int main() camera.reset(); cm->stop(); - return 0; + return EXIT_SUCCESS; }