Message ID | 20201201174314.12774-2-email@uajain.com |
---|---|
State | Accepted |
Delegated to: | Kieran Bingham |
Headers | show |
Series |
|
Related | show |
Hi Umang, Thank you for the patch. On Tue, Dec 01, 2020 at 11:13:11PM +0530, Umang Jain wrote: > 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 <email@uajain.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > 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<FrameBuffer> &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; > }
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<FrameBuffer> &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; }
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 <email@uajain.com> --- simple-cam.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)