From patchwork Fri Dec 4 06:54:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 10553 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 84A73BE177 for ; Fri, 4 Dec 2020 06:55:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4D45C635D2; Fri, 4 Dec 2020 07:55:05 +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="qqYLkn90"; 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 74891635D1 for ; Fri, 4 Dec 2020 07:55:03 +0100 (CET) From: Umang Jain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=uajain.com; s=mail; t=1607064903; bh=0KCGP4zxC3q9W8gTwNnQUVSqEd/MT8angyTCA5ukjzg=; h=From:To:Cc:Subject:In-Reply-To:References; b=qqYLkn90o9GmXkDLqGbfQ6qXP3nc4TQQp0038PfahHbnEEWkaNBapGhannhTD6V92 AHzA8mS9OL5bZJPP6jphLMDoQns1HRz5GiITfIfa1Bk5ZsMhVZa+ctEgQNjRWHyXH5 QIB6WZ6c5UR1aIc4YLcmcYc92ksO1/xyiGhx+dDvVU41BkT3srK8LYgcNfOJGStORQ CTXRlh02BGNMYFSxsB21DJnud0j1DStK/IjUIy0MCJVbwfkGsp4eJCBbqZwqb9h9rm Vhw+eCJAxJC0WaBZQH9IPOvsrMNwBsIp6xpwXJ2ETFLl0DRChxABK0swLBa5RYcWWA bsaxPqOMMBGzg== To: libcamera-devel@lists.libcamera.org Date: Fri, 4 Dec 2020 12:24:49 +0530 Message-Id: <20201204065452.2764628-2-email@uajain.com> In-Reply-To: <20201204065452.2764628-1-email@uajain.com> References: <20201204065452.2764628-1-email@uajain.com> Mime-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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 Reviewed-by: Kieran Bingham --- 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; }