From patchwork Mon May 31 02:07:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12474 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 65FCBC3206 for ; Mon, 31 May 2021 02:08:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7A74C68922; Mon, 31 May 2021 04:08:01 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="V7M0C5j2"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 97A5A6891F for ; Mon, 31 May 2021 04:07:58 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2E7E51178 for ; Mon, 31 May 2021 04:07:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1622426878; bh=8e+WjEE7j1S2SEp2nJgM1IJC2oM1b0M12tAAvOIdm8w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=V7M0C5j21k9BRXdVj1Con2puP1q74gUjZtn6CQBKu6+kd4lAGA6eR2KB/fxt/oOen Li8KYREar3wk4pp+vuEi4pmtGDE39JNV64u0SISZMhktaT340/bv/kUW0o7emsdPkT 1fGV1pbfrKeB5zA3oU+QDyZDpOiQfRYWwxX1xXro= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 31 May 2021 05:07:44 +0300 Message-Id: <20210531020745.13815-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531020745.13815-1-laurent.pinchart@ideasonboard.com> References: <20210531020745.13815-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] libcamera: pipeline: ipu3: Fix warning when compiled with optimization 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When compiling with optimization, gcc 9 and newer throw an unitialized variable warning: ../../src/libcamera/pipeline/ipu3/imgu.cpp: In function ‘void libcamera::{anonymous}::calculateBDSHeight(libcamera::ImgUDevice::Pipe*, const libcamera::Size&, const libcamera::Size&, unsigned int, float)’: ../../src/libcamera/pipeline/ipu3/imgu.cpp:172:17: error: ‘bdsHeight’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 172 | unsigned int bdsIntHeight = static_cast(bdsHeight); Neither clang not gcc versions older than 9 complain. This seems to be a false positive, work around it by initializing the bdsHeight variable when declaring it. Note that there are obvious errors in the code, with the second while () loop in the first part of calculateBDSHeight() modifying the bdsHeight variable set by the first loop even if the second loop doesn't find a suitable height, but that's out of scope for this fix. Signed-off-by: Laurent Pinchart Reviewed-by: Hirokazu Honda Tested-by: Jean-Michel Hautbois Reviewed-by: Jean-Michel Hautbois --- src/libcamera/pipeline/ipu3/imgu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp index 3e517ac67962..f3eaab648399 100644 --- a/src/libcamera/pipeline/ipu3/imgu.cpp +++ b/src/libcamera/pipeline/ipu3/imgu.cpp @@ -126,7 +126,7 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc unsigned int minIFHeight = iif.height - IF_CROP_MAX_H; unsigned int minBDSHeight = gdc.height + FILTER_H * 2; unsigned int ifHeight; - float bdsHeight; + float bdsHeight = 0.0f; if (!isSameRatio(pipe->input, gdc)) { unsigned int foundIfHeight = 0;