From patchwork Mon Nov 13 14:57:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 164530 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1257204vqg; Mon, 13 Nov 2023 06:58:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcWAd8aMbTqC/cJ9QHjA/drgckZqHSV2IyIMEA+9Cu/lo1nx/HdwycGkSmQfxXJLBWb+5S X-Received: by 2002:a17:902:e74b:b0:1cc:5e1b:98a7 with SMTP id p11-20020a170902e74b00b001cc5e1b98a7mr5095651plf.45.1699887494611; Mon, 13 Nov 2023 06:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699887494; cv=none; d=google.com; s=arc-20160816; b=vtX+bYUnzwsS2qzWU4+YK3i6kuNQ1cXtsbCx42ieigw/O55lszw20ICiHGrCj98p+a yoGB2kAnT3d+3KhTqZVHfu6BUz4u7Nu7KRCoKZU5MffTn8vCEBu/+grzPi8vlsyl446t 5EtQy7H+q8Jxu2ghbX1RdR1Ukt7sGcxfKvSA0qC+fkOHHEOP01cGppCkSW/oTwmQ+brg nj/Kw3vvsITbus4w8XYzqICV6BV5/0fGt24KQ87fjiYBc+CV2aqM1u3/UIHalQHFHJjv eO7QHiCdz+lgwVriVlQwsIi/z8Kto+pGSO9rVftVl7OgLlLg5ePF4jw5UHH01JJotjit aeDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=leYW5zoNQ+ApABUs14mu1OjZ7G1VzudQ+i7kL1VaH9Y=; fh=Yq1NgBa0/Jo3yXyDNjbJOlVDcVsSsXSxyCYh7doc+AA=; b=lpWSKtRUq35+OtzuRRVY+w2iTXtP+GYX25eLHHdhJELvzlC8pGyuyYMxP3R6196qKJ CJpb9FQLzfFvjnZ7ttzMWib6THbu0nslsBVFQXuD7AkIbAkgeOHvEiEGuJgyQPIA5zmE hJ7i4NI7waX7UP5O0G5yKzmotCX0F2BFQAK9HaaFccnwJd79OH/Zy7SIViWc+qRLpH5V Z4+MUGi/Oh+QI1fFvfpgva8kJp29o6rCR8ffILQanPzfhkzi/x47J5kKaH7ewqcrNWs1 NXWdA9NrjGbXk537WSn0vgmEnEItIXauVS5cO/nP9558/TzCQwDhJJhQdhvtvaRuAAoT eCbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b="X6Nd/GUt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id r22-20020a170902be1600b001bb95a5cb9fsi5583685pls.522.2023.11.13.06.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 06:58:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b="X6Nd/GUt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 86F5B80AD11A; Mon, 13 Nov 2023 06:58:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231315AbjKMO6C (ORCPT + 29 others); Mon, 13 Nov 2023 09:58:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229686AbjKMO6B (ORCPT ); Mon, 13 Nov 2023 09:58:01 -0500 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62668132; Mon, 13 Nov 2023 06:57:57 -0800 (PST) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3ADB72Xl018219; Mon, 13 Nov 2023 15:57:47 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=selector1; bh=leYW5zo NQ+ApABUs14mu1OjZ7G1VzudQ+i7kL1VaH9Y=; b=X6Nd/GUtFsddjGOAuGw+JSn CA9LzJfviWzSLHi9EE3Iz8OnaJgcLbGFndBuhT0VZGsBTuWspFErBRFF25aG9Gw1 +aH977PuOnXxCjhee8RRwCVJOPPx124SwrsmCsBpG6sVuDuLjo9clfHIMHhqvaCv T0awNCvTGqa4NOhViOvu8eVJAzH/4VvCJ3VPsQSU93gmicCSUFYX5TMDA5ga4SVI Nnf4YaOqv1iZGHHiNecYAg2EO8GbtoOphTJeoZgTcqY4cn49f9Z+L9WScERcoMz+ 7vUMjEg+1AWDQOk+dRmaD4bPqlPXeZm6SFEdpMyhJfveCuP4jMGq7wCFBtLRp6w= = Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3ua1cgypa3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Nov 2023 15:57:47 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 44CA910005B; Mon, 13 Nov 2023 15:57:46 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 3AC6D21ED28; Mon, 13 Nov 2023 15:57:46 +0100 (CET) Received: from localhost (10.129.178.213) 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.27; Mon, 13 Nov 2023 15:57:46 +0100 From: Alain Volmat To: Benjamin Mugnier , Sylvain Petinot , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Daniel Scally CC: , Jacopo Mondi , Alain Volmat , , Subject: [PATCH] media: i2c: st-mipid02: correct format propagation Date: Mon, 13 Nov 2023 15:57:30 +0100 Message-ID: <20231113145731.89796-1-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.129.178.213] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-13_05,2023-11-09_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 13 Nov 2023 06:58:12 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782461229388129376 X-GMAIL-MSGID: 1782461229388129376 Use a copy of the struct v4l2_subdev_format when propagating format from the sink to source pad in order to avoid impacting the sink format returned to the application. Thanks to Jacopo Mondi for pointing the issue. Fixes: 6c01e6f3f27b ("media: st-mipid02: Propagate format from sink to source pad") Signed-off-by: Alain Volmat Cc: stable@vger.kernel.org Reviewed-by: Jacopo Mondi Reviewed-by: Benjamin Mugnier Reviewed-by: Daniel Scally --- drivers/media/i2c/st-mipid02.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c index fa27638edc07..dab14787116b 100644 --- a/drivers/media/i2c/st-mipid02.c +++ b/drivers/media/i2c/st-mipid02.c @@ -770,6 +770,7 @@ static void mipid02_set_fmt_sink(struct v4l2_subdev *sd, struct v4l2_subdev_format *format) { struct mipid02_dev *bridge = to_mipid02_dev(sd); + struct v4l2_subdev_format source_fmt; struct v4l2_mbus_framefmt *fmt; format->format.code = get_fmt_code(format->format.code); @@ -781,8 +782,12 @@ static void mipid02_set_fmt_sink(struct v4l2_subdev *sd, *fmt = format->format; - /* Propagate the format change to the source pad */ - mipid02_set_fmt_source(sd, sd_state, format); + /* + * Propagate the format change to the source pad, taking + * care not to update the format pointer given back to user + */ + source_fmt = *format; + mipid02_set_fmt_source(sd, sd_state, &source_fmt); } static int mipid02_set_fmt(struct v4l2_subdev *sd,