From patchwork Tue Jan 21 13:00:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 22600 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 E022ABD16B for ; Tue, 21 Jan 2025 13:00:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C0D916851D; Tue, 21 Jan 2025 14:00:53 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DmO/LkO1"; 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 7058960380 for ; Tue, 21 Jan 2025 14:00:52 +0100 (CET) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 283FC788; Tue, 21 Jan 2025 13:59:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737464390; bh=BLQlZu6wfBSKhrDIngkxUU6kZee6rpgjS4VTTCDAhho=; h=From:To:Cc:Subject:Date:From; b=DmO/LkO13LzHKW1vTiCU8GXpGTR+oRe4/Vm1kvhaSVdAvcDQwbpZxsaOw2W2Xbrw5 4c9+Gft5iNPVVzO352yUn84DydUT+I7rj42OsqHU0/YsHbEujJiemGkuVSfUqO8YdV bADBPf7SHlrI67U7P15Bv44Rr0kt34PIaBX8ITwg= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally Subject: [PATCH] libcamera: mali-c55: Fix error paths in ::init() Date: Tue, 21 Jan 2025 13:00:37 +0000 Message-Id: <20250121130037.237947-1-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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" In the ::init() function there are two places that return values they shouldn't; the ret variable is returned after checking a pointer is not null instead of an explicit -ENODEV and later the boolean value false is returned on failure instead of the error value returned by V4L2Subdevice::open() - fix both problems. Signed-off-by: Daniel Scally Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/mali-c55/mali-c55.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libcamera/pipeline/mali-c55/mali-c55.cpp b/src/libcamera/pipeline/mali-c55/mali-c55.cpp index 5abd6b20..6aa2f2d9 100644 --- a/src/libcamera/pipeline/mali-c55/mali-c55.cpp +++ b/src/libcamera/pipeline/mali-c55/mali-c55.cpp @@ -159,15 +159,16 @@ int MaliC55CameraData::init() */ sensor_ = CameraSensorFactoryBase::create(entity_); if (!sensor_) - return ret; + return -ENODEV; const MediaPad *sourcePad = entity_->getPadByIndex(0); MediaEntity *csiEntity = sourcePad->links()[0]->sink()->entity(); csi_ = std::make_unique(csiEntity); - if (csi_->open()) { + ret = csi_->open(); + if (ret) { LOG(MaliC55, Error) << "Failed to open CSI-2 subdevice"; - return false; + return ret; } return 0;