From patchwork Tue Dec 17 17:39:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 851586 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 184E01F9EAD; Tue, 17 Dec 2024 17:41:52 +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=1734457315; cv=none; b=bXGrYgF/PjldnDVLzUbpmNuvPgJwUEXd4XsuLjK+Kp8L+6uxyIymrNqIuDxFBXsK/xgEQkw4oz6MvZJUbYNyLBfXFu6edUsrwjOhX2iUNO+V2hOdex2pqRrrzG6BWFS7O+ijS58VQJE1YYkMGDzXm0h6mi9HPB8o5BijEC5dmV0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734457315; c=relaxed/simple; bh=F1aA4riXIv0Q9S4y2DrfhZV5JLe5bLPLHXIsUombDoU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=j4Y5gJZB1h40Xo17TL9ZuJEB1lrDznJTz2OjxD2QZ6eReTopkTIWFNJfVaBsrb5KRdFhV+yOvxMTaraohBzsc0VdOOkZM42inuUZsR/V0bidmL51hf3ILd9YvVL1RnZ/6MIaGEprVM9PDeHXNx2fr2hZryIuIG5gkvPXlqygB1s= 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=Ci9V3/1a; 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="Ci9V3/1a" 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 4BHD9qtK008410; Tue, 17 Dec 2024 18:41:40 +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= MFkZT8NHU7DNuo+LKqsiFwQWUamjVt47LLzELPbysck=; b=Ci9V3/1aAsAA7aIj aWxu5NZz8bLqUhpLOMlv5gk9mHTFYpWke9jxnLqKeQbRb46rDQdXB8cwfon2gcnz SS9iSoJvO+8bEsAbMyIlZ2gTw3PVt0Tz1pd2vTTEPwlzlVWh9sCxf88sTqDTJ+BW dnD/6yAbSqdULOvlPj2URfdeRsERpjKG9nIhrunq2WlEVBhPUDeoSvu5D3uM2Vgk v8TqKL37eObGhJm30Hiw8L29oLNgLGJDRSGSeBt4FwchJ7lQ5qOI/WcSPlolkDwM u4s4u3LWuLFEv5APdy93NRWm3JzUmID4hn2XOzI/rom/Azvsj1iz4zEjk6rsYqJx msNmvA== 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 43k5h9jwaj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 18:41:40 +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 D403A4004B; Tue, 17 Dec 2024 18:40:18 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2CC8E284780; Tue, 17 Dec 2024 18:39:25 +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:24 +0100 From: Alain Volmat Date: Tue, 17 Dec 2024 18:39:18 +0100 Subject: [PATCH 1/9] media: stm32: dcmipp: correct ret type in dcmipp_graph_notify_bound Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241217-csi_dcmipp_mp25_enhancements-v1-1-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 The ret variable used within the function dcmipp_graph_notify_bound is wrongly defined as unsigned int while it can also be signed. Fixes: 28e0f3772296 ("media: stm32-dcmipp: STM32 DCMIPP camera interface driver") Cc: stable@vger.kernel.org Signed-off-by: Alain Volmat --- drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c index 71acf539e1f3..5a04018a6a9d 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c @@ -296,7 +296,7 @@ static int dcmipp_graph_notify_bound(struct v4l2_async_notifier *notifier, struct v4l2_async_connection *asd) { struct dcmipp_device *dcmipp = notifier_to_dcmipp(notifier); - unsigned int ret; + int ret; int src_pad, i; struct dcmipp_ent_device *sink; struct v4l2_fwnode_endpoint vep = { 0 }; From patchwork Tue Dec 17 17:39:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 851589 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 B588F1F8F13; 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=fzdN+8HxxZgUCtsX5oehr9zdig2KN8m3mNyYtrdZDI1KE45pL2UUvoFgqlf+6elfiW1DGA1T1BRiUSD2E7fGUBDS7k5UH5y46uQ3RrjcH8QG7dAkpN5Xe80n6C6fvqgYHExLmvKJkDTAJekhuQmKwbwNcs/xZx/0Pfrga9eQenk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734457311; c=relaxed/simple; bh=hInv0GDF9ASoCrA91erSiZif9QnCeKjru6B8Kk70+oQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=tYX8jVoePBOjV4FWioyJVnQcWRrgtEDsvpc8Ogo9Sk0z1prEoMpRC+YW7sfB2VBYsYixyrvk0yJ+Gi95y26Z6jn0uDXsnDtPqQwwyI2OOCcQOA71v6RWN/XxQV+xXVHEddwcVDCM+sYn2Qg2SsPdLvwTmF4eakzEbbyWTiYH0tA= 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=zNX30k2P; 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="zNX30k2P" Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BHDQcJP030946; Tue, 17 Dec 2024 18:41:30 +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= WMhEQ5FyK9OrG4uMjs+kjYbwMOyJiryWj2ETzJ64ZW8=; b=zNX30k2PU6TmCfAg KEHZWF2oHtjXM2VYUN1fVCnHIuiHFD3S2xQdQA5LLsGIl2W1k4KWahzxEeWfXTDz GdlleZx36i6/ziR/VPj6HM34UInNtItiBzaDv99sU0Bqdqc0oFgUOAj6Ytw9xCs1 HGWnRDGQxDv522vQx9DE3Cz9p6b52qZKJJ7yNAgHtGKXnjPxXNy2Pzg525L6qvsw 5ieqQ8NDEQNTnuRmjd93S4l00leE3eROOFZ66JVe0cGsNC0cLw4e1FoNz6aaQK+N Q38KAgBu1BNfdrfJ0Pdl4uFF2KId3rYZAcGCFY6AqWjZ2kACngH3NkvtYgRgc12P 6MygOA== 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 43k5c4u3be-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 18:41:30 +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 57B9440046; 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 6E9C228FD76; Tue, 17 Dec 2024 18:39:27 +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:27 +0100 From: Alain Volmat Date: Tue, 17 Dec 2024 18:39:20 +0100 Subject: [PATCH 3/9] media: stm32: csi: add missing pm_runtime_put on error Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241217-csi_dcmipp_mp25_enhancements-v1-3-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 Within the stm32_csi_start function, pm_runtime_put should be called upon error following pm_runtime_get_sync. Rework the function error handling by putting a label in order to have common error handling for all calls requiring pm_runtime_put. 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 48941aae8c9b..e2f63bb47d33 100644 --- a/drivers/media/platform/st/stm32/stm32-csi.c +++ b/drivers/media/platform/st/stm32/stm32-csi.c @@ -497,21 +497,19 @@ static int stm32_csi_start(struct stm32_csi_dev *csidev, ret = pm_runtime_get_sync(csidev->dev); if (ret < 0) - return ret; + goto error_put; /* Retrieve CSI2PHY clock rate to compute CCFR value */ phy_clk_frate = clk_get_rate(csidev->clks[STM32_CSI_CLK_CSI2PHY].clk); if (!phy_clk_frate) { - pm_runtime_put(csidev->dev); dev_err(csidev->dev, "CSI2PHY clock rate invalid (0)\n"); - return ret; + ret = -EINVAL; + goto error_put; } ret = stm32_csi_setup_lane_merger(csidev); - if (ret) { - pm_runtime_put(csidev->dev); - return ret; - } + if (ret) + goto error_put; /* Enable the CSI */ writel_relaxed(STM32_CSI_CR_CSIEN, csidev->base + STM32_CSI_CR); @@ -567,6 +565,10 @@ static int stm32_csi_start(struct stm32_csi_dev *csidev, writel_relaxed(0, csidev->base + STM32_CSI_PMCR); return ret; + +error_put: + pm_runtime_put(csidev->dev); + return ret; } static void stm32_csi_stop(struct stm32_csi_dev *csidev) From patchwork Tue Dec 17 17:39:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 851585 Received: from mx07-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 1026D1FC7E6; Tue, 17 Dec 2024 17:41:58 +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=1734457320; cv=none; b=Mnp9uz0H+8o9TJW47n2KKSfH1cTX1cMrrfOIsb77EZ65oYxJFCGhMqCgcbi5oMfmT6aV+UUv4mJsK3k93c+XfC6oLe8daIoPmxdQ4/SD5Wqt55tgOXWeqf1DAJ9JHBBUMhWz7QF6yNhl6hQbhXX+TJH8M9CrnZd/loOR6b5+RZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734457320; c=relaxed/simple; bh=S5yrghfkfc64FsaUCOJOIO6Cq0r+AwGaQMDZ7mr9mo8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ns1HY9aYZEudUNQ2QsviPdMzsEhxkmM8Rxyj3TrpP319WYL3zq474cnF24OC8ite6Ez2iwpR0UqyILBjG2IdNZlev45bcGl5mbdS1w48Yy8ZloKh53iZQEfUO/e00SmJbN6WIOi9KdtIT2M2QbEl2atQZfeM+LzHIHBi96eqHQc= 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=jR8rDuH8; 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="jR8rDuH8" Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BHDD0xc004545; Tue, 17 Dec 2024 18:41:44 +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=jR8rDuH8wprDtrPm WnQeLVCuC0OfQc4OVFvw9UK/6anCl6ZC+0jTAHHj+9VxtV9f7pCRRyRQZyUmj2eE wNfBcmfPrBA6Dq6QYOwRpR8AKrvKY88+FaLM3QHOOEQAg1hTtNRK1WnYrluIFJLd oVI316Kt4uYKzBzLqYcl0J5hDjM3FSusVO58BBbG60TS7mAVzvR8/ns/o02oy2rz hN78qYHLVF/SBi5Q6Kcwiet3gZJW2nREsAR7LJ5v7lJq3VNBbnKM0UEZ7SO0I7VI 7OrQJ8/S5ZUoh+6OhgfaTTb790hVdh/FdsxGOd7o6nukQnnyA68CUi9WhgkTqxbD fQkw2w== 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 43k689autk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 18:41:44 +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 7E5C74004C; Tue, 17 Dec 2024 18:40:20 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id C7E5C292896; Tue, 17 Dec 2024 18:39:30 +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:30 +0100 From: Alain Volmat Date: Tue, 17 Dec 2024 18:39:23 +0100 Subject: [PATCH 6/9] 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: <20241217-csi_dcmipp_mp25_enhancements-v1-6-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 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, From patchwork Tue Dec 17 17:39:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 851588 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 5A2E31527B1; Tue, 17 Dec 2024 17:41:50 +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=1734457312; cv=none; b=uQpHS/w6n9NVC4ii7DgYN7zwFrNY8BHAQLWbY3f4BKMNLp2Sem3K7oNXeMseI3FjavPbkdzJFeW3lekh40CmDICa3YYPPDyvo5rCDVK22kfd/Np3CvOTKCVDhC2ZAof0MSdT+8VmkVNC0xAE9s/Q9sot1NyshiTSR1iHYP1i+zg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734457312; c=relaxed/simple; bh=y3EATahbm8OVe3B3vCZV++vEa1ywAVvq7bev6SxUrTw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=sn6kIYDzqAjGfT/QWnOaT9F2b/j2dUbnqBaSzM+UQtcAmTBBAZA5yCuHV7Y9STzbtUgnDbAAMYl6zm7nQotTLZxf4j0Nskh0GM2tEaJTLebjeDS5/1KY57Fs6a1oCWv+x7RgGEv6+KUvC50M3ILZrew0okbfrrVko9IS+zfLqCI= 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=4Il6JQoG; 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="4Il6JQoG" 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 4BHCvnva000961; Tue, 17 Dec 2024 18:41:30 +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= 1OijE7D/bwZ86UgAtBbLF2m/QNftawfwPt9+VBoGOMA=; b=4Il6JQoG3WY0GlyR 24B7CWyp3y4xjoxwRFaowF6hCj2OyeWfQsmHOOK60FTtuwgTVuJgvrvz13906Vys oF9xvPuBlGC6XTtk/ERGKX1++7LQsRH5J/7UClg93YsUDkn3vgXBqLTPMa41Wvxi SaCBKwDq22DdninRj4brMSwYearonpJ0e5bijzKlqypN3558Lls6kkZqgdo/StU+ 29urYt7WF1XYIjW6xgh0weDJ3jIUtwaOmdp7fTwO45Q938g2gok0ESantRv6/aDp 8XDCgGpOYKKm25rq4GhXmlS17D07HHxcp3KdizasgBpb/n1VQk5/VutcLH+PFLw3 qPKT7w== 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 43k5ngavvg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 18:41:30 +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 1F12D4004F; Tue, 17 Dec 2024 18:40:22 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 17DE52945CB; Tue, 17 Dec 2024 18:39:33 +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:32 +0100 From: Alain Volmat Date: Tue, 17 Dec 2024 18:39:25 +0100 Subject: [PATCH 8/9] media: stm32: csi: correct unsigned or useless variable settings Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241217-csi_dcmipp_mp25_enhancements-v1-8-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 Correct several missing unsigned type missing for loop variables and also remove useless initialization of variables. Signed-off-by: Alain Volmat --- drivers/media/platform/st/stm32/stm32-csi.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c index 1be12c9dcf55..602b0879f21e 100644 --- a/drivers/media/platform/st/stm32/stm32-csi.c +++ b/drivers/media/platform/st/stm32/stm32-csi.c @@ -357,7 +357,7 @@ static inline struct stm32_csi_dev *to_csidev(struct v4l2_subdev *sd) static int stm32_csi_setup_lane_merger(struct stm32_csi_dev *csidev) { u32 lmcfgr = 0; - int i; + unsigned int i; for (i = 0; i < csidev->num_lanes; i++) { if (!csidev->lanes[i] || csidev->lanes[i] > STM32_CSI_LANES_MAX) { @@ -595,20 +595,20 @@ static int stm32_csi_start_vc(struct stm32_csi_dev *csidev, { struct v4l2_mbus_framefmt *mbus_fmt; const struct stm32_csi_fmts *fmt; - u32 cfgr1 = 0; - int ret = 0; u32 status; + u32 cfgr1; + int ret; mbus_fmt = v4l2_subdev_state_get_format(state, STM32_CSI_PAD_SOURCE); fmt = stm32_csi_code_to_fmt(mbus_fmt->code); /* If the mbus code is JPEG, don't enable filtering */ if (mbus_fmt->code == MEDIA_BUS_FMT_JPEG_1X8) { - cfgr1 |= STM32_CSI_VCXCFGR1_ALLDT; + cfgr1 = STM32_CSI_VCXCFGR1_ALLDT; cfgr1 |= fmt->input_fmt << STM32_CSI_VCXCFGR1_CDTFT_SHIFT; dev_dbg(csidev->dev, "VC%d: enable AllDT mode\n", vc); } else { - cfgr1 |= fmt->datatype << STM32_CSI_VCXCFGR1_DT0_SHIFT; + cfgr1 = fmt->datatype << STM32_CSI_VCXCFGR1_DT0_SHIFT; cfgr1 |= fmt->input_fmt << STM32_CSI_VCXCFGR1_DT0FT_SHIFT; cfgr1 |= STM32_CSI_VCXCFGR1_DT0EN; dev_dbg(csidev->dev, "VC%d: enable DT0(0x%x)/DT0FT(0x%x)\n", @@ -634,8 +634,8 @@ static int stm32_csi_start_vc(struct stm32_csi_dev *csidev, static int stm32_csi_stop_vc(struct stm32_csi_dev *csidev, u32 vc) { - int ret = 0; u32 status; + int ret; /* Stop the Virtual Channel */ writel_relaxed(STM32_CSI_CR_VCXSTOP(vc) | STM32_CSI_CR_CSIEN, @@ -714,7 +714,7 @@ static int stm32_csi_enable_streams(struct v4l2_subdev *sd, static int stm32_csi_init_state(struct v4l2_subdev *sd, struct v4l2_subdev_state *state) { - int i; + unsigned int i; for (i = 0; i < sd->entity.num_pads; i++) *v4l2_subdev_state_get_format(state, i) = fmt_default; @@ -879,7 +879,8 @@ static irqreturn_t stm32_csi_irq_thread(int irq, void *arg) static int stm32_csi_get_resources(struct stm32_csi_dev *csidev, struct platform_device *pdev) { - int irq, ret, i; + unsigned int i; + int irq, ret; csidev->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(csidev->base))