{"id":1472,"url":"https://patchwork.libcamera.org/api/1.1/patches/1472/?format=json","web_url":"https://patchwork.libcamera.org/patch/1472/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190619110548.20742-5-jacopo@jmondi.org>","date":"2019-06-19T11:05:48","name":"[libcamera-devel,v5,4/4] libcamera: v4l2: Standardize return value checks","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"0a895e6c7607f5bbb96b4d223e9544a16b4734b7","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":{"id":15,"url":"https://patchwork.libcamera.org/api/1.1/users/15/?format=json","username":"jmondi","first_name":"Jacopo","last_name":"Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/patch/1472/mbox/","series":[{"id":363,"url":"https://patchwork.libcamera.org/api/1.1/series/363/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=363","date":"2019-06-19T11:05:44","name":"libcamera: Introduce V4L2Device base class","version":5,"mbox":"https://patchwork.libcamera.org/series/363/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1472/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1472/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7E2C261ACC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Jun 2019 13:04:46 +0200 (CEST)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 1A10DFF818;\n\tWed, 19 Jun 2019 11:04:45 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 4/4] libcamera: v4l2: Standardize\n\treturn value checks","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 19 Jun 2019 11:04:46 -0000"},"content":"Standardize all return values checks on the 'if (ret)' style where\nappropriate.\n\nNo functional changes intended.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/v4l2_subdevice.cpp   |  2 +-\n src/libcamera/v4l2_videodevice.cpp | 18 +++++++++---------\n 2 files changed, 10 insertions(+), 10 deletions(-)","diff":"diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex d0e1d717b26c..7f887e377c97 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -340,7 +340,7 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n \tsel.r.height = rect->h;\n \n \tint ret = ioctl(VIDIOC_SUBDEV_S_SELECTION, &sel);\n-\tif (ret < 0) {\n+\tif (ret) {\n \t\tLOG(V4L2, Error)\n \t\t\t<< \"Unable to set rectangle \" << target << \" on pad \"\n \t\t\t<< pad << \": \" << strerror(-ret);\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex bcbac79e82e9..d1409fcafa04 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -305,11 +305,11 @@ int V4L2VideoDevice::open()\n \tint ret;\n \n \tret = V4L2Device::open(O_RDWR | O_NONBLOCK);\n-\tif (ret < 0)\n+\tif (ret)\n \t\treturn ret;\n \n \tret = ioctl(VIDIOC_QUERYCAP, &caps_);\n-\tif (ret < 0) {\n+\tif (ret) {\n \t\tLOG(V4L2, Error)\n \t\t\t<< \"Failed to query device capabilities: \"\n \t\t\t<< strerror(-ret);\n@@ -633,7 +633,7 @@ int V4L2VideoDevice::requestBuffers(unsigned int count)\n \trb.memory = memoryType_;\n \n \tret = ioctl(VIDIOC_REQBUFS, &rb);\n-\tif (ret < 0) {\n+\tif (ret) {\n \t\tLOG(V4L2, Error)\n \t\t\t<< \"Unable to request \" << count << \" buffers: \"\n \t\t\t<< strerror(-ret);\n@@ -684,7 +684,7 @@ int V4L2VideoDevice::exportBuffers(BufferPool *pool)\n \t\tbuf.m.planes = planes;\n \n \t\tret = ioctl(VIDIOC_QUERYBUF, &buf);\n-\t\tif (ret < 0) {\n+\t\tif (ret) {\n \t\t\tLOG(V4L2, Error)\n \t\t\t\t<< \"Unable to query buffer \" << i << \": \"\n \t\t\t\t<< strerror(-ret);\n@@ -736,7 +736,7 @@ int V4L2VideoDevice::createPlane(Buffer *buffer, unsigned int planeIndex,\n \texpbuf.flags = O_RDWR;\n \n \tret = ioctl(VIDIOC_EXPBUF, &expbuf);\n-\tif (ret < 0) {\n+\tif (ret) {\n \t\tLOG(V4L2, Error)\n \t\t\t<< \"Failed to export buffer: \" << strerror(-ret);\n \t\treturn ret;\n@@ -927,7 +927,7 @@ int V4L2VideoDevice::queueBuffer(Buffer *buffer)\n \tLOG(V4L2, Debug) << \"Queueing buffer \" << buf.index;\n \n \tret = ioctl(VIDIOC_QBUF, &buf);\n-\tif (ret < 0) {\n+\tif (ret) {\n \t\tLOG(V4L2, Error)\n \t\t\t<< \"Failed to queue buffer \" << buf.index << \": \"\n \t\t\t<< strerror(-ret);\n@@ -963,7 +963,7 @@ Buffer *V4L2VideoDevice::dequeueBuffer()\n \t}\n \n \tret = ioctl(VIDIOC_DQBUF, &buf);\n-\tif (ret < 0) {\n+\tif (ret) {\n \t\tLOG(V4L2, Error)\n \t\t\t<< \"Failed to dequeue buffer: \" << strerror(-ret);\n \t\treturn nullptr;\n@@ -1022,7 +1022,7 @@ int V4L2VideoDevice::streamOn()\n \tint ret;\n \n \tret = ioctl(VIDIOC_STREAMON, &bufferType_);\n-\tif (ret < 0) {\n+\tif (ret) {\n \t\tLOG(V4L2, Error)\n \t\t\t<< \"Failed to start streaming: \" << strerror(-ret);\n \t\treturn ret;\n@@ -1044,7 +1044,7 @@ int V4L2VideoDevice::streamOff()\n \tint ret;\n \n \tret = ioctl(VIDIOC_STREAMOFF, &bufferType_);\n-\tif (ret < 0) {\n+\tif (ret) {\n \t\tLOG(V4L2, Error)\n \t\t\t<< \"Failed to stop streaming: \" << strerror(-ret);\n \t\treturn ret;\n","prefixes":["libcamera-devel","v5","4/4"]}