From nobody Thu Dec 18 09:46:59 2025 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (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 82EE11F8F0B; Tue, 17 Dec 2024 17:41:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734457311; cv=none; b=DIeHN79rJ+kMSpxRSKEf5iP9kk6QEyErA8ths4xLxhQHRMZWvM+fuwcoxYdmchSnXpSmXmHVn6oTNryMXjg8OOKardbq6XYj+gp9EmNXRRhX77dRU3qWDHSSxFm19ZCW3ofUJ154vOwkPMTW7MqwMxmGQAeKqrXYKjr1VrCfuvQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734457311; c=relaxed/simple; bh=r0AJlSN7QqihCiLwaihti1kJ+4heRiIoggwRFK3Zq4w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ks0k8aGQJIfhSI/RDn05oASjjXuzIST69xA26O0jW2FpBC4BkqT9/EIQxuEk/mmAl1YUw0U4SNUWSl+fq04bkCeV0alKrj5DeLdd5q+OLcVXv2908donOkdtcx/9hKiKpJt1wSuctI1bK18LDRVyvxQVzCaRW/2g0hhLVCcEM9c= 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=H335tpHY; arc=none smtp.client-ip=185.132.182.106 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="H335tpHY" Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BHD9qtI008410; Tue, 17 Dec 2024 18:41:26 +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= KypdGnyKgLl4nhvMId8FZobhUoEfqEaVUPzgI6v5dkk=; b=H335tpHYP5jCXwXe NWSYmv2md7kclq5VcyXzN/bMfS8tH3ZI+xMOZ0t0eoNWLgmRLFP2xBJWEprcZ2ox g5zM7l6wYjEQT84EK2tjCTVTt4VbSaNVXyMFXdGOx+sUbnlq72Pxz7eeJ/+UDBXN B+7DOKBMLhBPlM8QAOMBznjLq/ZwOzYdAsGQSuBapjuJSyTwDVXl0/xQsIOE01Fj BHvGbiPQLuVxrgBPPseS4zUwNg5zbaj9UF4joYICoMPNqkGwn4A9MZ8Bm5iD/lYx joTQtv6593rWMbb5GB/Mcs+LPpu9qHKjHL23zg27qJ1OEIK8qeKZoq0zzS4agO9G T3CU2Q== 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 43k5h9jwa0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 18:41:25 +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 7C6C640049; Tue, 17 Dec 2024 18:40:16 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 8DCFB28A65A; Tue, 17 Dec 2024 18:39:28 +0100 (CET) Received: from localhost (10.252.23.235) 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; Tue, 17 Dec 2024 18:39:28 +0100 From: Alain Volmat Date: Tue, 17 Dec 2024 18:39:21 +0100 Subject: [PATCH 4/9] media: stm32: csi: register subdev only at end of probe Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20241217-csi_dcmipp_mp25_enhancements-v1-4-2b432805d17d@foss.st.com> References: <20241217-csi_dcmipp_mp25_enhancements-v1-0-2b432805d17d@foss.st.com> In-Reply-To: <20241217-csi_dcmipp_mp25_enhancements-v1-0-2b432805d17d@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 Call v4l2_async_register_subdev only whenever all initialization are completed at the end of the probe function. Remove as well useless err_free_priv label by returning directly upon error. Signed-off-by: Alain Volmat --- drivers/media/platform/st/stm32/stm32-csi.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/pl= atform/st/stm32/stm32-csi.c index e2f63bb47d33..89fcd7d07904 100644 --- a/drivers/media/platform/st/stm32/stm32-csi.c +++ b/drivers/media/platform/st/stm32/stm32-csi.c @@ -991,11 +991,11 @@ static int stm32_csi_probe(struct platform_device *pd= ev) =20 ret =3D stm32_csi_get_resources(csidev, pdev); if (ret) - goto err_free_priv; + return ret; =20 ret =3D stm32_csi_parse_dt(csidev); if (ret) - goto err_free_priv; + return ret; =20 csidev->sd.owner =3D THIS_MODULE; csidev->sd.dev =3D &pdev->dev; @@ -1020,10 +1020,6 @@ static int stm32_csi_probe(struct platform_device *p= dev) if (ret < 0) goto err_cleanup; =20 - ret =3D v4l2_async_register_subdev(&csidev->sd); - if (ret < 0) - goto err_cleanup; - /* Reset device */ rstc =3D devm_reset_control_get_exclusive(&pdev->dev, NULL); if (IS_ERR(rstc)) { @@ -1050,6 +1046,10 @@ static int stm32_csi_probe(struct platform_device *p= dev) =20 pm_runtime_enable(&pdev->dev); =20 + ret =3D v4l2_async_register_subdev(&csidev->sd); + if (ret < 0) + goto err_cleanup; + dev_info(&pdev->dev, "Probed CSI with %u lanes\n", csidev->num_lanes); =20 @@ -1057,7 +1057,6 @@ static int stm32_csi_probe(struct platform_device *pd= ev) =20 err_cleanup: v4l2_async_nf_cleanup(&csidev->notifier); -err_free_priv: return ret; } =20 --=20 2.34.1