Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp661750lqt; Mon, 18 Mar 2024 22:34:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLpQsLtycwqy6erhEV45gNjjEPMIcCbanG4+a3ViAZOzMQ/dZdZD5lwPBi0WOzcwanNOkU+lPE3UEjS9paR0+e2y1oJ4f6NHly73R+kQ== X-Google-Smtp-Source: AGHT+IEeBMM8WMl5dm3CxXnI1LtWSzT4NUUmGRFF52MCMqv2EBCYF6vqWsVl3e6B66pQLuT/O25P X-Received: by 2002:ad4:4ba6:0:b0:691:3549:340a with SMTP id i6-20020ad44ba6000000b006913549340amr13021041qvw.42.1710826440373; Mon, 18 Mar 2024 22:34:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710826440; cv=pass; d=google.com; s=arc-20160816; b=ecJ7QvTCkQ/XoGxeLrQfv9iJGQHvimHiNoqrohaq5GtFJol4fmlsbbebgUiRZK+b5q aglJ44u7ABnhYzdB+5/nc1tLKuy1jz+g+5mN6XA22K3XeOMA+RdXbJz6T/hzQvtgXI29 WY+nDvi0QBPMxlIxGSj7LWeDiQy7RX2CnNijp/M0oQhtvGbw36kVXyT2dApbtdOxt7Cz UYldRoEQsCyfDA//SZy6V0DbvkLS2ZciHIsDKvQhozGjTtgnuQ/LCcgN/giC2Q/XVthd Xbr6MVxV77D26+gYoY6TY8L7/0eG1Hdsyb+Fp/Fvhgtch+BWMRSFRMj976eHyN7fNXQA eZRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=54zM+zC5Az6/tCHmwj9MegRN+Ro+8fWPByYi2vq9/n4=; fh=FQEUFAV7EfOFg4lhjGgQfqiiCE7413CuAiFR07q1Ymw=; b=QbeXgDOHAtIAhe1R2UgDXaKGnHfKHlfEWZwXrqXUdtgtiQw8t4vPtULEFY13GWDD5O bRo63/7QEqvTStt93Es/Khft/mP0wumywY79x/IlBIA2EzFQUXoHP14tzq/wBgdMz2vO cdJANY9Lfvti4iGJUv58msaH0nZl3vwMa2zItVjUeFn0Vz1TE1HxKtdwglTFmcMbpe0k RvmAGuBdK7poUqM8YHfz0eHU6xA0p4rnDXNUPrTI8eTQ0qHIQr8wTrZAZu5OBMYVjNXJ n03hK3G2xzMyfy0G5WfI0WnE4VIPCj3Sz2XH3a7AoF6gj+A9EO8kcnAlgZBxnp9EPk8d +A+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=tUB3kP8o; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-107015-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107015-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id mf7-20020a0562145d8700b00690d9ed71d5si10182113qvb.503.2024.03.18.22.34.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 22:34:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107015-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=tUB3kP8o; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-107015-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107015-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1F50A1C2189A for ; Tue, 19 Mar 2024 05:34:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D287A45940; Tue, 19 Mar 2024 05:33:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tUB3kP8o" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 9FA5A40871; Tue, 19 Mar 2024 05:33:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710826430; cv=none; b=Rf5bsro/4Dz4T9XI7ar1JN+lb58UFrKlC/bmSSvJIfNgnEmkwTiNyaX6yy29WBSVHRK9CjCBA18qn089SWiDjb3tJs9xr9Q3WBMZ9DyJ2IOS5PwWt7DMc7ZaTSzage/G+ghYx3vMPRhuAk2wwrjaiEG/juw73Etk0rBLl0P1UHY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710826430; c=relaxed/simple; bh=hCDPkxTHGQvH545yk0oqwcxu6hu8OpzaJxwRoWq28dw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gXzfH7kMWxRjT35BjlgBIPjo6mzERdtXhPa/EOOoq8vFzvdG7owGcOMbTAabW6e4SJEXZCZ4VjzIpELLuMQeTLPXH6JoIVWpDC4792gzsCSLkFdsJSyNqp7RtIXNjTcJZ88SoMuBDcqXDrDdpHch9wST4/rfPBWhgzgRrMUnscg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=tUB3kP8o; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from [192.168.1.105] (unknown [103.86.18.138]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D13DABB2; Tue, 19 Mar 2024 06:33:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1710826396; bh=hCDPkxTHGQvH545yk0oqwcxu6hu8OpzaJxwRoWq28dw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=tUB3kP8ooFzLUJp5PVdQZaVmcckNaFyO3mHENmJd0B73CvFKbJMQxa0NYk9S5uDgE hoWnArFLcbqDE/gcAUcG3JeGgcvXEuFC4cmr6mFb2x6kGQs3CuAZnkwYKqaqfjIFVb 7b4slumxNc0oawcY4UX0pTpe3cytnTIvaL3q1vmc= Message-ID: <64594704-4d2b-416f-952a-e6ff45828e35@ideasonboard.com> Date: Tue, 19 Mar 2024 11:03:35 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/6] media: imx335: Parse fwnode properties Content-Language: en-US To: Tommaso Merciai Cc: linux-media@vger.kernel.org, Alexander Shiyan , Kieran Bingham , Sakari Ailus , open list , Dave Stevenson References: <20240308083312.90279-1-umang.jain@ideasonboard.com> <20240308083312.90279-3-umang.jain@ideasonboard.com> From: Umang Jain In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Tommaso, On 08/03/24 4:26 pm, Tommaso Merciai wrote: > Hi Umang, Kieram, > > On Fri, Mar 08, 2024 at 02:03:08PM +0530, Umang Jain wrote: >> From: Kieran Bingham >> >> Call the V4L2 fwnode device parser to handle controls that are >> standardised by the framework. >> >> Signed-off-by: Kieran Bingham >> Signed-off-by: Umang Jain >> --- >> drivers/media/i2c/imx335.c | 13 ++++++++++++- >> 1 file changed, 12 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c >> index 7162b0a3cef3..819ab3a6c5fc 100644 >> --- a/drivers/media/i2c/imx335.c >> +++ b/drivers/media/i2c/imx335.c >> @@ -1225,10 +1225,12 @@ static int imx335_init_controls(struct imx335 *imx335) >> { >> struct v4l2_ctrl_handler *ctrl_hdlr = &imx335->ctrl_handler; >> const struct imx335_mode *mode = imx335->cur_mode; >> + struct v4l2_fwnode_device_properties props; >> u32 lpfr; >> int ret; >> >> - ret = v4l2_ctrl_handler_init(ctrl_hdlr, 7); >> + /* v4l2_fwnode_device_properties can add two more controls */ >> + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 9); >> if (ret) >> return ret; >> >> @@ -1300,6 +1302,15 @@ static int imx335_init_controls(struct imx335 *imx335) >> return ctrl_hdlr->error; >> } >> >> + ret = v4l2_fwnode_device_parse(imx335->dev, &props); >> + if (ret) >> + return ret; >> + >> + ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx335_ctrl_ops, >> + &props); >> + if (ret) >> + return ret; >> + >> imx335->sd.ctrl_handler = ctrl_hdlr; >> >> return 0; > Just a doubt on my side. > We don't need an error path to free ctrl_hdlr? > Or I'm missing something? No, you are right. We need to free the ctrl_hdlr on error patch. > > Something similar: > > ret = v4l2_fwnode_device_parse(imx335->dev, &props); > if (ret) > goto free_ctrls; > > ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx335_ctrl_ops, > &props); > if (ret) > return ret; > > free_ctrls: > v4l2_ctrl_handler_free(hdl); > return ret; > > Thanks & Regards, > Tommaso > >> -- >> 2.43.0 >> >>