From patchwork Wed Jan 8 13:16:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 13930903 Received: from mx08-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DE7F1F2C44; Wed, 8 Jan 2025 13:21:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736342484; cv=none; b=A8FAaw8sPhFQneuxUbHkksDQj4qrFhgpsBE5bXffajHwYk8egKAcgz6HBrqXVTZINE+m0125i3pX0soBGsftYc/5PE6g5sURk9uj9PM85zcePbpAXOR79DBtmCFNjWVxjFtpOnYh4FN1UwfmX+LYTe8OwuKjOlt0fKYdUZ6jqkY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736342484; c=relaxed/simple; bh=S5yrghfkfc64FsaUCOJOIO6Cq0r+AwGaQMDZ7mr9mo8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=UNROm2iyBn4PLqm5rAyuPQaz28bGMF0efGNrvXm2lQfCma5NaUj7UHbinlu9aWtkm4IwaflVzk3K0A4jL+w8dcs6AavG2vhj8KchkUDI0bSoIOp5eM2bxHJLPICjLJCCNQmdBVSq+eajD4M0N6kOyxKcda9LQOcAaQVbMthJCLc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=u9RZxc70; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="u9RZxc70" Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 508DL3fj027097; Wed, 8 Jan 2025 14:21:03 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= fuFnMO3ijaaacswBw6QbcsmE5nKXXLvyIsQw+1GMwgY=; b=u9RZxc70cXLvchBK iYjHnAd3gcyecsNcts+g7QfKgG3n9T2Ob2yyg03VgrBBdK7rHRAidZqYzO1tH+m5 X7pO7OrEh0wUwNKW0RZO4g1By5wt3Adey527HOe69Y0u/9QfKKd1VfJMOzP7saCE H+E2iYGyYhUh7G12J4hhyWRkeKlxQ+ULXfOnNmSYavI2ztBN1gC/nkvNGWZIJAkX RdWS3XEN0B12uNNtRa62GLfqGmFG9CDfhA7nZmc5ZSQ1e7RAjJnonFYIS0JX34IA vKZbBeP5N8tA6vfy7RyDx0Q33zYxlhMBWZ8jIiObj83MpxFrB+1pZO8Hze8byZkl 5Wp46w== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 441at8k85j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jan 2025 14:21:03 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 7697D40044; Wed, 8 Jan 2025 14:19:37 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 6975126E530; Wed, 8 Jan 2025 14:16:15 +0100 (CET) Received: from localhost (10.252.31.140) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Wed, 8 Jan 2025 14:16:15 +0100 From: Alain Volmat Date: Wed, 8 Jan 2025 14:16:08 +0100 Subject: [PATCH v2 5/8] media: stm32: csi: simplify enable_streams error handling Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20250108-csi_dcmipp_mp25_enhancements-v2-5-05808ce50e41@foss.st.com> References: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> In-Reply-To: <20250108-csi_dcmipp_mp25_enhancements-v2-0-05808ce50e41@foss.st.com> To: Hugues Fruchet , Mauro Carvalho Chehab , Maxime Coquelin , Alexandre Torgue , Hans Verkuil , Sakari Ailus , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , , , Alain Volmat X-Mailer: b4 0.14.1 X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 Put all error handling for VC stop and CSI stop together to avoid duplication of code. Signed-off-by: Alain Volmat --- drivers/media/platform/st/stm32/stm32-csi.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c index 3654f9895dbc..4affbc00b042 100644 --- a/drivers/media/platform/st/stm32/stm32-csi.c +++ b/drivers/media/platform/st/stm32/stm32-csi.c @@ -694,19 +694,21 @@ static int stm32_csi_enable_streams(struct v4l2_subdev *sd, ret = stm32_csi_start_vc(csidev, state, 0); if (ret) { dev_err(csidev->dev, "Failed to start VC0\n"); - stm32_csi_stop(csidev); - return ret; + goto failed_start_vc; } ret = v4l2_subdev_enable_streams(csidev->s_subdev, csidev->s_subdev_pad_nb, BIT_ULL(0)); - if (ret) { - stm32_csi_stop_vc(csidev, 0); - stm32_csi_stop(csidev); - return ret; - } + if (ret) + goto failed_enable_streams; return 0; + +failed_enable_streams: + stm32_csi_stop_vc(csidev, 0); +failed_start_vc: + stm32_csi_stop(csidev); + return ret; } static int stm32_csi_init_state(struct v4l2_subdev *sd,