From patchwork Thu Oct 22 08:17:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 10194 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 D9786C3D3C for ; Thu, 22 Oct 2020 08:17:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 596546113E; Thu, 22 Oct 2020 10:17:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ozTGpoZ0"; dkim-atps=neutral Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CF6D960351 for ; Thu, 22 Oct 2020 10:17:49 +0200 (CEST) Received: by mail-lj1-x242.google.com with SMTP id p15so972252ljj.8 for ; Thu, 22 Oct 2020 01:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WjvKOLmQorb3MNvkiZVJZv9BXLmYWqgQG8yB7vySHuY=; b=ozTGpoZ0nYGMMSVElGiXpBVW+9IG5+S5ciPhY5kaopN+dzT49wFPkQ2rNi7FWtUiPq yZoCLzjkMrrs5K7zVqhjNMvs3hT/ou5NHyDkB+yJogADaG5GBjQ4dr9LGcYoke9bhGDR LaN42kR2TpgjoNMEu98iC59dRq1nUY23dJTme5WQvNQXD4oxtyL/2dV9jDMT7kGIiJms LTwoCsRNDx5uY7zBWYO0YeA5tW1mQBVp46vJXyDlkcbDx72foNBXH3BlhWd5+z0tho+c BHXSWocmece03IqNfsV/mI95WRw13ibHTO8sTktuh67k4VSXGioIE7wVLXKrqd3/SlVf 6SuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=WjvKOLmQorb3MNvkiZVJZv9BXLmYWqgQG8yB7vySHuY=; b=k+lP0rIY4WUgN+FP+72otUowrq0fSi1TQjHUbzTxLb41DzaF36BRXGxXUurMJ0M1pG pzs5RNXqhg9imk8ei7meiHP/5nk/eVKEklCw+TYrnXXjiVZJGJuJLdw10KqLXtxqPJXq bb/4+n9Lz7njIQDChhKVnTzsNSUozwxGUHKBycZLW9iLZ74s0zNaXk803ENRtpvVUVbO q+Tc5uAI8FWuhygtuzXMuNgAasJuJg552WR+D2nIrr4a2B8qQhTihYqIiTX3dLzxrPg+ p13jI4pvIeYFJU+D+vEXTP4E+Xf3shIAD4HMU8KHsKKBNewrNW9FTCJEGETQsHmeQQxN IcGQ== X-Gm-Message-State: AOAM530SxpHWM3hfombV/AImdHw9r08QaCZyBYBxft46ykJCBIp1wuco RyDPaDqEQb5cz57ok4UBYoK9FI624swMTw== X-Google-Smtp-Source: ABdhPJzXnXLz3fJLORN9dNIEJ87mr1YMWoUNLPG+Dti01erZv5kBNbi8i0akkRjeSl9lXBO0RGXXKg== X-Received: by 2002:a05:651c:97:: with SMTP id 23mr516177ljq.376.1603354669059; Thu, 22 Oct 2020 01:17:49 -0700 (PDT) Received: from deskari.lan (91-152-83-50.elisa-laajakaista.fi. [91.152.83.50]) by smtp.gmail.com with ESMTPSA id l3sm187007lji.36.2020.10.22.01.17.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2020 01:17:48 -0700 (PDT) From: Tomi Valkeinen To: libcamera-devel@lists.libcamera.org Date: Thu, 22 Oct 2020 11:17:28 +0300 Message-Id: <20201022081731.36217-1-tomi.valkeinen@iki.fi> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/4] Add .clang-tidy 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: , Cc: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Having .clang-tidy file will give us a 'clang-tidy' meson build target, so doing a full clang-tidy run can be done just by: ninja -C build clang-tidy I did not look at if more checks should be enabled or not. I disabled clang-diagnostic-c99-designator as that feature was used in the code, and I see no harm with the feature. Signed-off-by: Tomi Valkeinen Reviewed-by: Kieran Bingham --- .clang-tidy | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .clang-tidy diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 00000000..4c47fa8c --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,3 @@ +Checks: -clang-diagnostic-c99-designator +FormatStyle: file + From patchwork Thu Oct 22 08:17:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 10195 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 C9872C3D3C for ; Thu, 22 Oct 2020 08:17:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A2B4C613E6; Thu, 22 Oct 2020 10:17:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VIoeAs/R"; dkim-atps=neutral Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7332160351 for ; Thu, 22 Oct 2020 10:17:50 +0200 (CEST) Received: by mail-lj1-x244.google.com with SMTP id m20so981096ljj.5 for ; Thu, 22 Oct 2020 01:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ur181zJY4BDVdAz0cbEk0Cx2tq726LoO8afr6LItANI=; b=VIoeAs/R2hVf7aG+5+HEK1RJUHZb8/Yi3P0hsQ7eJMlQLYS25rQzO0HwN6EwavP1iD y21/Cd4OQdiqhmkAkYJs8wtasJ3ME84UdenK/U21HQ9fYvDBYvgRISB1hFtDwjzc9biS eHV4efrX4kC16us8l2fD77JQT72/n0xPfTPtM/NUFk8gHFdhTB7KfdznnL+WghDkMC/c qsFTkDYglc9vMUNVWiANABRiL/mGNjI86XqBc+rxmZTZuuNncN+wontzCYH3D/bxvCxx a7fKi+IvkJGyUZxriYPA9JVP1Q4KBrDq5rtW3EgXQaexSTELE+/9ymc55a13szV3H07m fVqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Ur181zJY4BDVdAz0cbEk0Cx2tq726LoO8afr6LItANI=; b=jiRr9KArHNUaKoqXHS+dQfGvbXwWHaScENyW0CC9wyLv1Dhenmt3KzDvyXHJVTJRyq tKQVfjlGKqed3wmaFU88pgO4Nol0IwO8E1cLjpGKRWioO3yIGBLTTRYC+6XX9eCl9qI2 i3rCess7TPOi3HS3u/4+04eqIu8j6V7b3u7JsOTpVmsSmpqVSRGvcPyzd4d0Dt12tUh0 gCOOSAOZWPyoD53lBY7xu/9EUEG9KZAnnktdPUjB0AWvhezb3vfc0Z8bJ2kmdjtXK7b4 r6TjowTlP89vzwetXVxKn78edUE+Oo2nC5KpYeP7WuLLEeDgz1aIMu8V+yHw4UvqddvI CWww== X-Gm-Message-State: AOAM532GwntnHfNTDVI21jotNuYRFxsO65CX/4q9f9TWPapy4ja4HWte 5h04lpM9eUf3Sh/EoBSwUp9Jdyw0fXKF8Q== X-Google-Smtp-Source: ABdhPJy9hUTNIf4xIeUHhig9cDP9BrYGbQEJ71iyV4vOfeE3m4OykuYKizSG4errTR+eX1Tk/fZ6Cg== X-Received: by 2002:a2e:3915:: with SMTP id g21mr520049lja.18.1603354669786; Thu, 22 Oct 2020 01:17:49 -0700 (PDT) Received: from deskari.lan (91-152-83-50.elisa-laajakaista.fi. [91.152.83.50]) by smtp.gmail.com with ESMTPSA id l3sm187007lji.36.2020.10.22.01.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2020 01:17:49 -0700 (PDT) From: Tomi Valkeinen To: libcamera-devel@lists.libcamera.org Date: Thu, 22 Oct 2020 11:17:29 +0300 Message-Id: <20201022081731.36217-2-tomi.valkeinen@iki.fi> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201022081731.36217-1-tomi.valkeinen@iki.fi> References: <20201022081731.36217-1-tomi.valkeinen@iki.fi> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/4] pipeline: raspberrypi: return an error if setFormat() fails 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: , Cc: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The method calls setFormat(), stores the return value, but then does not do anything with the return value. I presume it is meant to fail and return the error. Signed-off-by: Tomi Valkeinen Reviewed-by: Naushir Patuck Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index dd62dfc7..aa8d9340 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -586,6 +586,8 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) * because of flips in the sensor. */ ret = data->isp_[Isp::Input].dev()->setFormat(&sensorFormat); + if (ret) + return ret; /* * See which streams are requested, and route the user From patchwork Thu Oct 22 08:17:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 10196 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 35007C3D3C for ; Thu, 22 Oct 2020 08:17:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 02EF961451; Thu, 22 Oct 2020 10:17:55 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ksB+2PMK"; dkim-atps=neutral Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2CC4760530 for ; Thu, 22 Oct 2020 10:17:51 +0200 (CEST) Received: by mail-lj1-x22b.google.com with SMTP id x16so992792ljh.2 for ; Thu, 22 Oct 2020 01:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jqnB/BtIX3D+kr8HI42UutvPxNkoC0nsGGkFaAmI3UA=; b=ksB+2PMKUkEjBJG2W0qs3LEb+46ybxio2KjnS2AViaBDJPSuEuRYaKYFrzV5QgPaZv qtaupfLb1IBDvqQYx3RHBdiPpAaaZg30jSwuAc4mD/O/MfxDd7ZJhNdNUkyRBrHiUfdt EX9EhCMsciiUcQr5IiUL2zcmGmfbdg4r50VbM+evaRXMQT/lpEa0CriDw463Ppf1wpyD lH+UiTWypgO7mBB6tED1lzEvV2pGtXD9jxje8A/wB0eGhKmZK1Un2NvyqSs6H1Ah0sUA eglbuJK8tZKLDko28VIfxHSehrtjJgOnEhFIp71CGfHCb7rw7+fqCxZPa6cGueBfnQVe odkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=jqnB/BtIX3D+kr8HI42UutvPxNkoC0nsGGkFaAmI3UA=; b=a276j/GnnHS2T3M+7DfN8rMB/dbCsGV0ktJtJeBOTzaCJSZdQe6IAUEGhG6tHvNACs pqKj1HbAaqFj81C5De/3seDratp4WXeoigew4RMEkMuAQ2OvOyjvbSfPzYksCVKPrS/+ aYZ2cEiTKHTtUKoC8aaV7l6p/D2ciY2Go09bIiiYzFiqzm0n+oPsxQwp1DGLu5ihYuWS 0pplAuiJLoW2JO8cFL0Qal2H/NYaCPvvxmA8Fl1QIpvY/0CSVlqON2l+pZekYpvNGDvx G3NthuquK6pyCR8OqTw9wyMiUVXb44Z+5buuXk3G0gfIq+lCXVTGhefmtJqOkNFb3R2d 9zgA== X-Gm-Message-State: AOAM532MmSD3P2AkcuCGOzw/Gdym9lUudcyZExPf8hU9xlGzUFHoFjxK 1U4zM33lUQkyOPKNUk0n9CR8x2nLqWQDfQ== X-Google-Smtp-Source: ABdhPJydL2crB5lJ2RVItKDoTae90TtBB4F4mJWxXI/VxijH9duZhD8bkjuBOj0DqIGANrvFXrip5w== X-Received: by 2002:a2e:9689:: with SMTP id q9mr505355lji.434.1603354670503; Thu, 22 Oct 2020 01:17:50 -0700 (PDT) Received: from deskari.lan (91-152-83-50.elisa-laajakaista.fi. [91.152.83.50]) by smtp.gmail.com with ESMTPSA id l3sm187007lji.36.2020.10.22.01.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2020 01:17:50 -0700 (PDT) From: Tomi Valkeinen To: libcamera-devel@lists.libcamera.org Date: Thu, 22 Oct 2020 11:17:30 +0300 Message-Id: <20201022081731.36217-3-tomi.valkeinen@iki.fi> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201022081731.36217-1-tomi.valkeinen@iki.fi> References: <20201022081731.36217-1-tomi.valkeinen@iki.fi> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/4] libcamera: pipeline: simple: return from match() on error 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: , Cc: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" If converter_->open() fails, the code deletes the converter_ but then happily goes on, and at the very next lines will use converter_. I assume the intention is to return from the function with false. Signed-off-by: Tomi Valkeinen --- src/libcamera/pipeline/simple/simple.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 0d48e1b6..df93bc8d 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -774,6 +774,7 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator) << "Failed to open converter, disabling format conversion"; delete converter_; converter_ = nullptr; + return false; } converter_->bufferReady.connect(this, &SimplePipelineHandler::converterDone); From patchwork Thu Oct 22 08:17:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 10197 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 9C7A8C3D3C for ; Thu, 22 Oct 2020 08:17:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 52AEA6145E; Thu, 22 Oct 2020 10:17:55 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tC3kiCcg"; dkim-atps=neutral Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 13A6A610FD for ; Thu, 22 Oct 2020 10:17:52 +0200 (CEST) Received: by mail-lj1-x22e.google.com with SMTP id c21so955551ljn.13 for ; Thu, 22 Oct 2020 01:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CNofFG72K/VFMDGmKHy1QkddTDq69y/CgSjwZQOhlRk=; b=tC3kiCcg/LncF/r6Qqi0qkAzcf6P3qJKAe8oBL2FR7pEtBJkDSTs/pxsQBNAtqRXR7 6gVl1rIhONxoh9RbPu78z6IroTEHre00E0MG+M7dZmodyfYKgR5Xbmj8zKVJ3cVYTmWl 1wMxu7xgRfylMMuZHYtTW+jpISUriVK1GYQgIpAGDAAr2jeadBXYOQDQjI4Y/4Xoc7Xf Qv7eFyVEKIGbeM4msx5KMV9QZ9BPA6/2BQFJ8JSZEU1NaIQTA2Lpvvgro6UVIjCFnZ89 wGBkD43y5uHymynjB3OwTJBMslIblsGpWwVdgNsdzi05VrD0A0CnK3MfZcaHEl58HThF da7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=CNofFG72K/VFMDGmKHy1QkddTDq69y/CgSjwZQOhlRk=; b=aB+L57dclcv5LO4d0DEl+ZU+eHcRgWsindmCuixL80qj92rQY0UBtNVvgykDt4zYc2 OeTRxWEDmveDSk1Ne2gCn6fujNHxD8C3FbSZbqUErInd76UK5jFwsoRQscF8bHxaGKuM DpskYJ6O0ZjwE6DkvdufuaK9xlKZbvHWf5Bq+6sNryPUqjcZvu2APMYzWnE7G6I+iWHd CnNPUN8HtOmQTvFU/Uou9QaLF0LAAjgk8TlAHVqnlR+BXxBqSbz3ljxXuDNP3I9LUXEn fj7S6od4kgHuV7vW7XAAxXtaK6xIGyc40mD+qV8Ta+tSZ0BIsyaeL5iNhcUX6lbmDKcm WvYg== X-Gm-Message-State: AOAM531yh4G8FHCpYptk2rsFODcirThHpBX0f0iUa5zSOu5ND31JUJwq 8DislIRtYH3ujLHSn1GvfrOIB9izqn3M3g== X-Google-Smtp-Source: ABdhPJzT23WNeF0PKYOHEu0tEKyoMrkXnFYyuVEOMalqrIksoVfaxjc67bwArALU/lvzW7WhGucRXg== X-Received: by 2002:a05:651c:291:: with SMTP id b17mr571919ljo.177.1603354671298; Thu, 22 Oct 2020 01:17:51 -0700 (PDT) Received: from deskari.lan (91-152-83-50.elisa-laajakaista.fi. [91.152.83.50]) by smtp.gmail.com with ESMTPSA id l3sm187007lji.36.2020.10.22.01.17.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2020 01:17:50 -0700 (PDT) From: Tomi Valkeinen To: libcamera-devel@lists.libcamera.org Date: Thu, 22 Oct 2020 11:17:31 +0300 Message-Id: <20201022081731.36217-4-tomi.valkeinen@iki.fi> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201022081731.36217-1-tomi.valkeinen@iki.fi> References: <20201022081731.36217-1-tomi.valkeinen@iki.fi> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 4/4] HACK: suppress clang-tidy warnings 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: , Cc: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" These are quick hacks to silence clang-tidy warnings. The purpose of this patch is just to highlight the warnings on the mailing list, and also, if you want to try to fix some of the warnings, it may be nice to have all the rest suppressed. Afaics, the thread->moveObject(this) warning is a false positive. Probably some of the others are too. Note that I used assert() there in a few places, just after ASSERT(). The reason being, ASSERT() just prints an error, while assert() aborts, so clang-tidy takes the assert() seriously. Not for merging. Signed-off-by: Tomi Valkeinen --- src/ipa/raspberrypi/controller/histogram.cpp | 2 +- src/libcamera/object.cpp | 3 ++- src/libcamera/pipeline/ipu3/ipu3.cpp | 1 + src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 ++ src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 ++ src/libcamera/v4l2_device.cpp | 1 - src/libcamera/v4l2_pixelformat.cpp | 2 +- 7 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ipa/raspberrypi/controller/histogram.cpp b/src/ipa/raspberrypi/controller/histogram.cpp index 9916b3ed..ac3f5c48 100644 --- a/src/ipa/raspberrypi/controller/histogram.cpp +++ b/src/ipa/raspberrypi/controller/histogram.cpp @@ -51,7 +51,7 @@ double Histogram::InterQuantileMean(double q_lo, double q_hi) const double p_lo = Quantile(q_lo); double p_hi = Quantile(q_hi, (int)p_lo); double sum_bin_freq = 0, cumul_freq = 0; - for (double p_next = floor(p_lo) + 1.0; p_next <= ceil(p_hi); + for (double p_next = floor(p_lo) + 1.0; p_next <= ceil(p_hi); // NOLINT: Variable 'p_next' with floating point type 'double' should not be used as a loop counter [clang-analyzer-security.FloatLoopCounter] p_lo = p_next, p_next += 1.0) { int bin = floor(p_lo); double freq = (cumulative_[bin + 1] - cumulative_[bin]) * diff --git a/src/libcamera/object.cpp b/src/libcamera/object.cpp index cd83c684..1b1775e6 100644 --- a/src/libcamera/object.cpp +++ b/src/libcamera/object.cpp @@ -257,7 +257,8 @@ void Object::moveToThread(Thread *thread) notifyThreadMove(); - thread->moveObject(this); + // clang-tidy thinks that the thread can be deleted via DeferredDelete handling in notifyThreadMove() + thread->moveObject(this); // NOLINT: warning: Use of memory after it is freed [clang-analyzer-cplusplus.NewDelete] } void Object::notifyThreadMove() diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index af47739d..eac27153 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -508,6 +508,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) * be at least one active stream in the configuration request). */ if (!vfCfg) { + assert(mainCfg); ret = imgu->configureViewfinder(*mainCfg, &outputFormat); if (ret) return ret; diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index aa8d9340..4544d606 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1290,6 +1290,7 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer) /* The buffer must belong to one of our streams. */ ASSERT(stream); + assert(stream); LOG(RPI, Debug) << "Stream " << stream->name() << " buffer dequeue" << ", buffer id " << index @@ -1358,6 +1359,7 @@ void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer) /* The buffer must belong to one of our ISP output streams. */ ASSERT(stream); + assert(stream); LOG(RPI, Debug) << "Stream " << stream->name() << " buffer complete" << ", buffer id " << index diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index c74a2e9b..be55c32f 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -379,6 +379,8 @@ protected: if (!info) LOG(RkISP1, Fatal) << "Frame not known"; + assert(info); + /* * \todo: If parameters are not filled a better method to handle * the situation than queuing a buffer with unknown content diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 31d4dad0..f747ba79 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -243,7 +243,6 @@ ControlList V4L2Device::getControls(const std::vector &ids) LOG(V4L2, Error) << "Unable to read control " << errorIdx << ": " << strerror(-ret); count = errorIdx - 1; - ret = errorIdx; } updateControls(&ctrls, v4l2Ctrls, count); diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 03ab085c..354136b7 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -163,7 +163,7 @@ std::string V4L2PixelFormat::toString() const } if (fourcc_ & (1 << 31)) - strcat(ss, "-BE"); + memcpy(ss + 4, "-BE", 3); return ss; }