[{"id":4122,"web_url":"https://patchwork.libcamera.org/comment/4122/","msgid":"<20200320113145.GE5193@pendragon.ideasonboard.com>","date":"2020-03-20T11:31:45","subject":"Re: [libcamera-devel] [PATCH 05/11] libcamera: v4l2_controls: Fix\n\tusage of strerror()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Mon, Mar 09, 2020 at 05:24:08PM +0100, Jacopo Mondi wrote:\n> On failure, the return code from V4L2Device::ioctl() is the negative error\n> code set by the failed ::ioctl() system call. When the return code of\n> V4L2Device::ioctl() is provided to strerror() it has to be negated again\n> to obtain the positive error code. Fix a few wrong usages of the return\n> code which provided to the strerror() function a negative error code.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nThis is an independent bug fix, feel free to push it already.\n\n> ---\n>  src/libcamera/v4l2_device.cpp | 8 ++++----\n>  1 file changed, 4 insertions(+), 4 deletions(-)\n> \n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 98639bd0f07f..179476e9afad 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -201,13 +201,13 @@ int V4L2Device::getControls(ControlList *ctrls)\n>  \t\t/* Generic validation error. */\n>  \t\tif (errorIdx == 0 || errorIdx >= count) {\n>  \t\t\tLOG(V4L2, Error) << \"Unable to read controls: \"\n> -\t\t\t\t\t << strerror(ret);\n> +\t\t\t\t\t << strerror(-ret);\n>  \t\t\treturn -EINVAL;\n>  \t\t}\n>  \n>  \t\t/* A specific control failed. */\n>  \t\tLOG(V4L2, Error) << \"Unable to read control \" << errorIdx\n> -\t\t\t\t << \": \" << strerror(ret);\n> +\t\t\t\t << \": \" << strerror(-ret);\n>  \t\tcount = errorIdx - 1;\n>  \t\tret = errorIdx;\n>  \t}\n> @@ -291,13 +291,13 @@ int V4L2Device::setControls(ControlList *ctrls)\n>  \t\t/* Generic validation error. */\n>  \t\tif (errorIdx == 0 || errorIdx >= count) {\n>  \t\t\tLOG(V4L2, Error) << \"Unable to set controls: \"\n> -\t\t\t\t\t << strerror(ret);\n> +\t\t\t\t\t << strerror(-ret);\n>  \t\t\treturn -EINVAL;\n>  \t\t}\n>  \n>  \t\t/* A specific control failed. */\n>  \t\tLOG(V4L2, Error) << \"Unable to set control \" << errorIdx\n> -\t\t\t\t << \": \" << strerror(ret);\n> +\t\t\t\t << \": \" << strerror(-ret);\n>  \t\tcount = errorIdx - 1;\n>  \t\tret = errorIdx;\n>  \t}","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5CC7060416\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Mar 2020 12:32:29 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B7F16504;\n\tFri, 20 Mar 2020 12:32:28 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584703948;\n\tbh=Gk4+AiQMja+XIWX2oZtKhsl7cwrdDHgPeRKgiemWItA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=pgpsPYOCRy/EqaAdoz8q9oNGAGbbdtWSu/bEb/KMMkBGEtOxxUK+zac3jxLMBVor+\n\tmzEntAuwY5rQvML/IEbQksjJ0zNaVNZnuPVxXDk45nwec0/DD92+pJW3KEiiwXzqFb\n\t8FZ9YdmudxXBE1vtZCl3dN7l6VRkIKDeg1Zq7sow=","Date":"Fri, 20 Mar 2020 13:31:45 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200320113145.GE5193@pendragon.ideasonboard.com>","References":"<20200309162414.720306-1-jacopo@jmondi.org>\n\t<20200309162414.720306-6-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200309162414.720306-6-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 05/11] libcamera: v4l2_controls: Fix\n\tusage of strerror()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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":"Fri, 20 Mar 2020 11:32:29 -0000"}}]