Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp295559lqh; Sat, 4 May 2024 01:26:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUIUuEh8CnuSqIUjJoF2oqvaskv92HWd9Flk8INc5eKh3fnHfhciEsSnZPX5RB2bO1i1vIvet7We4Nxc+kXOyzhGU3vlcFu3KpUUA0a2w== X-Google-Smtp-Source: AGHT+IHYy7mONLkIItGtfTua+Xx/lEXJlqlrAu2uzjNKna4lb+M8qyovbmkfUrHKdw+RQUoMNCU0 X-Received: by 2002:a05:620a:29cd:b0:790:d62a:da09 with SMTP id s13-20020a05620a29cd00b00790d62ada09mr6312668qkp.5.1714811165047; Sat, 04 May 2024 01:26:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714811165; cv=pass; d=google.com; s=arc-20160816; b=XKB2L4SG2zu/lAohmvPaqiMuootBWB1Qz7SXcDvD8XCt4ZeUO4YkE2dInmeC6Pt/WQ FbpN+wTbFwmKMk/BoEXq4rzGBn1Ibsagiz3GgJd0CPxnx9XJGsGzLjp0r4FKdKmHHARL vZYFrLwj6j6buxtHEuV0nqb3Ul5lOALETqfeIH10rvFiHLtUgYKMIvFn967PvwgpLlw0 zqnMCIg1ojoqP7gc+j9mOltOb4lF+fOnKl3eloGwoN59rTbnx6SQRTnarZcDf8bXYqap F/Q+dAb6BNTtZf45L6jz9rcLXBtGdEDbVtgVhSJw5NX6GE6aX5tw8C9z/DJTJ3M/p4Ef b7SA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=Bvxa5Ghw6q8TLyky9vq+n1CJsW+UqOuJkMtWxibrlRM=; fh=jJfy2fxtTeUHSq/F3cWqNojGE5470lQzOq/ogz/pESQ=; b=qJthD9u2O9uEkwXJ290dyIxK6DwipceowFXEuhSPUg0/3t+AnFEz6oGDgUGc0k0Xqi C6+scOHdGtQ5iDfO6MJLPIHMp514FHDK89w7WDg/P2LpTKm8VFDYNdEpDSeNh/S779JA bJk2CggXr2DUu2ZQn9vDy4omKp6d7lQLULn+Tq93jX74W8f7rIcVsmvzmciSh9ghceHl s3az4Hz4Y5Hj0L4JAnMzKuDurOuOPi17nSmBAJIrmuYVEA8p6m7OsKHoMoHAFnBpmhy2 JkjRE7sKia6l0HTuQ6rBSL1Y0v6BYLSBpdBY3G34FJR4dti/5TI4a3v/T7wcGpqjcqm3 Bs0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-168552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168552-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id oo1-20020a05620a530100b00790676ab6b3si4902531qkn.691.2024.05.04.01.26.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 01:26:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-168552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-168552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168552-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl 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 728341C21163 for ; Sat, 4 May 2024 08:26:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9DD9D12E61; Sat, 4 May 2024 08:25:51 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D673B57CAE; Sat, 4 May 2024 08:25:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714811151; cv=none; b=tEwoob+G8Sc/Oxiw3au/0NUnsMqrWWEAP1LMUOAf/11hSq4vPkaPSKl5CEhj8tVA/XTUft3TCaSVBL4XMjlAi/4+NvDtQ9JS/Z7muooBFB8Ek7W2tblMaAdCQq85sRoNfVEuxubDZxUMmjnw4h/Euk/2E8MgxxF3dgeWUmdsf8I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714811151; c=relaxed/simple; bh=fLeV6TQVWA84Es9rMG8vcDpeqrwOawiwQupR9rySaYE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TXIBzkWbW39eMdByYkaNObAsRxyBHrs693ZNELoU/f0GwEbNi0zjIVUIVDwv1mU2AfjgmJtsjqA79hcfD+dNBQm/S1puTKy3/wRddanI6r6GG0BLyJwokWmXb8x36fFdozI8zr2x+uIc1/5OVn1zj4G+MplsKLOV1mFLDrnGLK4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 164C3C072AA; Sat, 4 May 2024 08:25:43 +0000 (UTC) Message-ID: <5780ea67-eff1-4c0e-9443-1cd7d61aa581@xs4all.nl> Date: Sat, 4 May 2024 10:25:42 +0200 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 09/26] media: v4l: async: refactor v4l2_async_create_ancillary_links Content-Language: en-US, nl To: Ricardo Ribalda , Laurent Pinchart Cc: Sakari Ailus , Martin Tuma , Mauro Carvalho Chehab , Hugues Fruchet , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Paul Kocialkowski , Greg Kroah-Hartman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , Matthias Brugger , AngeloGioacchino Del Regno , Sergey Kozlov , Abylay Ospan , Ezequiel Garcia , Dmitry Osipenko , Benjamin Mugnier , Sylvain Petinot , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org References: <20240419-fix-cocci-v2-0-2119e692309c@chromium.org> <20240419-fix-cocci-v2-9-2119e692309c@chromium.org> <40b9c015-8ccf-4313-800a-ecae9aa8cc27@xs4all.nl> <20240424184603.GA6282@pendragon.ideasonboard.com> From: Hans Verkuil Autocrypt: addr=hverkuil@xs4all.nl; keydata= xsFNBFQ84W0BEAC7EF1iL4s3tY8cRTVkJT/297h0Hz0ypA+ByVM4CdU9sN6ua/YoFlr9k0K4 BFUlg7JzJoUuRbKxkYb8mmqOe722j7N3HO8+ofnio5cAP5W0WwDpM0kM84BeHU0aPSTsWiGR yw55SOK2JBSq7hueotWL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wW IQQFLN57whUFO2ifG8q9LWFIZhQ7TA1WD/9yxJvQrpf6LcNrr8uMlQWCg2iz2q1LGt1Itkuu KaavEF9nqHmoqhSfZeAIKAPn6xuYbGxXDrpN7dXCOH92fscLodZqZtK5FtbLvO572EPfxneY UT7JzDc/5LT9cFFugTMOhq1BG62vUm/F6V91+unyp4dRlyryAeqEuISykhvjZCVHk/woaMZv c1Dm4Uvkv0Ilelt3Pb9J7zhcx6sm5T7v16VceF96jG61bnJ2GFS+QZerZp3PY27XgtPxRxYj AmFUeF486PHx/2Yi4u1rQpIpC5inPxIgR1+ZFvQrAV36SvLFfuMhyCAxV6WBlQc85ArOiQZB Wm7L0repwr7zEJFEkdy8C81WRhMdPvHkAIh3RoY1SGcdB7rB3wCzfYkAuCBqaF7Zgfw8xkad KEiQTexRbM1sc/I8ACpla3N26SfQwrfg6V7TIoweP0RwDrcf5PVvwSWsRQp2LxFCkwnCXOra gYmkrmv0duG1FStpY+IIQn1TOkuXrciTVfZY1cZD0aVxwlxXBnUNZZNslldvXFtndxR0SFat sflovhDxKyhFwXOP0Rv8H378/+14TaykknRBIKEc0+lcr+EMOSUR5eg4aURb8Gc3Uc7fgQ6q UssTXzHPyj1hAyDpfu8DzAwlh4kKFTodxSsKAjI45SLjadSc94/5Gy8645Y1KgBzBPTH7Q== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 29/04/2024 12:51, Ricardo Ribalda wrote: > Hi Hans > > Your proposal is what I sent for v1: > https://lore.kernel.org/linux-media/20240415-fix-cocci-v1-9-477afb23728b@chromium.org/ I decided to go for the v1. I prefer it, and more importantly, Sakari as maintainer of this code prefers it as well. Regards, Hans > > I have no strong opinion for any of the two, please feel free to land > whatever version you prefer. > > > Regards > > On Wed, 24 Apr 2024 at 20:46, Laurent Pinchart > wrote: >> >> On Wed, Apr 24, 2024 at 06:17:31PM +0000, Sakari Ailus wrote: >>> On Wed, Apr 24, 2024 at 12:55:20PM +0200, Hans Verkuil wrote: >>>> On 19/04/2024 11:47, Ricardo Ribalda wrote: >>>>> Return 0 without checking IS_ERR or PTR_ERR if CONFIG_MEDIA_CONTROLLER >>>>> is not enabled. >>>>> >>>>> This makes cocci happier: >>>>> >>>>> drivers/media/v4l2-core/v4l2-async.c:331:23-30: ERROR: PTR_ERR applied after initialization to constant on line 319 >>>>> >>>>> Signed-off-by: Ricardo Ribalda >>>>> --- >>>>> drivers/media/v4l2-core/v4l2-async.c | 7 +++---- >>>>> 1 file changed, 3 insertions(+), 4 deletions(-) >>>>> >>>>> diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c >>>>> index 4bb073587817..915a9f3ea93c 100644 >>>>> --- a/drivers/media/v4l2-core/v4l2-async.c >>>>> +++ b/drivers/media/v4l2-core/v4l2-async.c >>>>> @@ -316,9 +316,10 @@ v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier); >>>>> static int v4l2_async_create_ancillary_links(struct v4l2_async_notifier *n, >>>>> struct v4l2_subdev *sd) >>>>> { >>>>> - struct media_link *link = NULL; >>>>> + struct media_link *link; >>>>> >>>>> -#if IS_ENABLED(CONFIG_MEDIA_CONTROLLER) >>>>> + if (!IS_ENABLED(CONFIG_MEDIA_CONTROLLER)) >>>>> + return 0; >>>>> >>>>> if (sd->entity.function != MEDIA_ENT_F_LENS && >>>>> sd->entity.function != MEDIA_ENT_F_FLASH) >>>>> @@ -326,8 +327,6 @@ static int v4l2_async_create_ancillary_links(struct v4l2_async_notifier *n, >>>>> >>>>> link = media_create_ancillary_link(&n->sd->entity, &sd->entity); >>>>> >>>>> -#endif >>>>> - >>>>> return IS_ERR(link) ? PTR_ERR(link) : 0; >>>>> } >>>> >>>> I think I would prefer: >>>> >>>> static int v4l2_async_create_ancillary_links(struct v4l2_async_notifier *n, >>>> struct v4l2_subdev *sd) >>>> { >>>> #if IS_ENABLED(CONFIG_MEDIA_CONTROLLER) >>>> struct media_link *link; >>>> >>>> ... >>>> >>>> return IS_ERR(link) ? PTR_ERR(link) : 0; >>>> #else >>>> return 0; >>>> #endif >>>> } >>>> >>> >>> Me, too. >> >> I actually prefer Ricardo's proposal :-) >> >> -- >> Regards, >> >> Laurent Pinchart > > >