From patchwork Wed Jun 19 11:05:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 1472 X-Patchwork-Delegate: jacopo@jmondi.org Return-Path: Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7E2C261ACC for ; Wed, 19 Jun 2019 13:04:46 +0200 (CEST) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 1A10DFF818; Wed, 19 Jun 2019 11:04:45 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 19 Jun 2019 13:05:48 +0200 Message-Id: <20190619110548.20742-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190619110548.20742-1-jacopo@jmondi.org> References: <20190619110548.20742-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 4/4] libcamera: v4l2: Standardize return value checks X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jun 2019 11:04:46 -0000 Standardize all return values checks on the 'if (ret)' style where appropriate. No functional changes intended. Signed-off-by: Jacopo Mondi --- src/libcamera/v4l2_subdevice.cpp | 2 +- src/libcamera/v4l2_videodevice.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index d0e1d717b26c..7f887e377c97 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -340,7 +340,7 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target, sel.r.height = rect->h; int ret = ioctl(VIDIOC_SUBDEV_S_SELECTION, &sel); - if (ret < 0) { + if (ret) { LOG(V4L2, Error) << "Unable to set rectangle " << target << " on pad " << pad << ": " << strerror(-ret); diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index bcbac79e82e9..d1409fcafa04 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -305,11 +305,11 @@ int V4L2VideoDevice::open() int ret; ret = V4L2Device::open(O_RDWR | O_NONBLOCK); - if (ret < 0) + if (ret) return ret; ret = ioctl(VIDIOC_QUERYCAP, &caps_); - if (ret < 0) { + if (ret) { LOG(V4L2, Error) << "Failed to query device capabilities: " << strerror(-ret); @@ -633,7 +633,7 @@ int V4L2VideoDevice::requestBuffers(unsigned int count) rb.memory = memoryType_; ret = ioctl(VIDIOC_REQBUFS, &rb); - if (ret < 0) { + if (ret) { LOG(V4L2, Error) << "Unable to request " << count << " buffers: " << strerror(-ret); @@ -684,7 +684,7 @@ int V4L2VideoDevice::exportBuffers(BufferPool *pool) buf.m.planes = planes; ret = ioctl(VIDIOC_QUERYBUF, &buf); - if (ret < 0) { + if (ret) { LOG(V4L2, Error) << "Unable to query buffer " << i << ": " << strerror(-ret); @@ -736,7 +736,7 @@ int V4L2VideoDevice::createPlane(Buffer *buffer, unsigned int planeIndex, expbuf.flags = O_RDWR; ret = ioctl(VIDIOC_EXPBUF, &expbuf); - if (ret < 0) { + if (ret) { LOG(V4L2, Error) << "Failed to export buffer: " << strerror(-ret); return ret; @@ -927,7 +927,7 @@ int V4L2VideoDevice::queueBuffer(Buffer *buffer) LOG(V4L2, Debug) << "Queueing buffer " << buf.index; ret = ioctl(VIDIOC_QBUF, &buf); - if (ret < 0) { + if (ret) { LOG(V4L2, Error) << "Failed to queue buffer " << buf.index << ": " << strerror(-ret); @@ -963,7 +963,7 @@ Buffer *V4L2VideoDevice::dequeueBuffer() } ret = ioctl(VIDIOC_DQBUF, &buf); - if (ret < 0) { + if (ret) { LOG(V4L2, Error) << "Failed to dequeue buffer: " << strerror(-ret); return nullptr; @@ -1022,7 +1022,7 @@ int V4L2VideoDevice::streamOn() int ret; ret = ioctl(VIDIOC_STREAMON, &bufferType_); - if (ret < 0) { + if (ret) { LOG(V4L2, Error) << "Failed to start streaming: " << strerror(-ret); return ret; @@ -1044,7 +1044,7 @@ int V4L2VideoDevice::streamOff() int ret; ret = ioctl(VIDIOC_STREAMOFF, &bufferType_); - if (ret < 0) { + if (ret) { LOG(V4L2, Error) << "Failed to stop streaming: " << strerror(-ret); return ret;