Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp624932lqd; Wed, 24 Apr 2024 11:48:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+a+awVbXIK353lYHkrdZFNCSVCXk+skxOuZj+533QGKlPWAsSIGbS1YALk+d4BdQPRASR77GfR0ETWkRrSbG+xIBqhmNVxvCBWKze8A== X-Google-Smtp-Source: AGHT+IHwL0dBG3jGN50/MsJ++W1ReGZ00tRrtUXSuxPAJlvyfCe9vYIH+1mCL1SjqTRpib44vuOJ X-Received: by 2002:a05:6359:4281:b0:183:fb11:723a with SMTP id kp1-20020a056359428100b00183fb11723amr3453255rwb.11.1713984494217; Wed, 24 Apr 2024 11:48:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713984494; cv=pass; d=google.com; s=arc-20160816; b=F4PhKJbMZxVVjdS/CUtK7dC5Ptt2PCyIAPEsTLX56gwTgSTd4o68o0kBpwyCKy8Qvv nZgYSMgXJxTxrgcmHCdd0mbXEiP6xlfjBYvCgnq8/atKNz+BqFyKr712GgFrm/YKbXHz 5slgOIusEZRhhZiF4tVLCLnTZcoejjAkjiN2TF93vKa3Vc+O5esUMYdHF7CjPk6yLmwY G17ABQBSBG43kzilPqzj4er8p/Dp/UXl1+Eaur1uTscmkuzfbbkb0AI4Zmjdmrer077G sa4NwYW9ayZ7QARVM9a2x0RzniLkaeOhK3qE28wc7oZdLESYivUjs1A8R675FBKMxSHe 4m8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UmzvC+uE95uvTZNFVb/rgoIhUNHjXdDqUEl48fEuhmw=; fh=aX2iOg74M3Y0uBQkMY0Q0/bbcpp3LMJnNFxybvrlUBc=; b=a9WZCRDoZWQm35GJx664rCSot7agjTCovWhHEaBONf9CtbhofPes8CGllYsGl2xMCO CS6mUfA+40CRkE4bWgtUfHldv7GJ8He2TKb8kqbCsDesQdG7Ya9jGRYkwmxtUKkSRIX3 u11hNJ8YZeyIk32MYuST59FTtER2MG2rjuNgRTEAsivxe3WozutXQuk7b0fx6tA6Rnlv 0Wvb9CQmcRHPBeh56NL3ahzrvFHGzsqszUhiM8iT9oNYQJaA6e3FfLp8uHc8nXp8B9Aa bf/kqNnIEeWK9WSWvVL8fgkhpoggVVgK2LJSF/CagfXKPmBCNCg8Zhj9FsPjGPJGjXWo HO9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=LyWtD7Hh; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-157554-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157554-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 y18-20020a05622a165200b004315f5a26a9si16531714qtj.661.2024.04.24.11.48.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 11:48:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157554-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=LyWtD7Hh; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-157554-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157554-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 378A91C2536E for ; Wed, 24 Apr 2024 18:47:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D5952E645; Wed, 24 Apr 2024 18:46:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="LyWtD7Hh" 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 CD3CC2C6BD; Wed, 24 Apr 2024 18:46:12 +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=1713984374; cv=none; b=F0DXXeS6Y1PIcNA2iW2rV4pa0tPZ6paIc6NWDvjFqTJtxZOJIwbLLttwLdt9RMLaLnkio6h5p9WX2tVe+C33N2VSDFSLXTz/Uf6hwXsBnBDxkeIAHKGZfrqpo927FQbQZkSKwM9YSsWjJSVTl1rZmiZDGskzmnyGQW+D3E2avFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713984374; c=relaxed/simple; bh=s3FyBov567J2QGOwzCsWd6sbv2/5L8BTtQKZYmfBE4o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EA83Z3VnZ+ltasfyYkxXEUrTOmPIjBkCcPYsPj1D+FCHvjzjNXQYOYplxl/Ctu4gfzbwvfSLZuCRYHKDGEfZmBh30BqsmTQVBnbez3kIsPPOWVZOHypGY19lyvou14Khqt2NcKfACvkkX44j+l8z9NtELBJPKShZi65o7z+On28= 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=LyWtD7Hh; 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 pendragon.ideasonboard.com (117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4E133B1; Wed, 24 Apr 2024 20:45:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713984318; bh=s3FyBov567J2QGOwzCsWd6sbv2/5L8BTtQKZYmfBE4o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LyWtD7HhQFhNcsJLXImxTlEO9zSrnA0XXnPz447uiAF/Ub8UwT4XZ+hvcyDUMkod9 TdsIHxHej3MnvOv6+cPx44pYbMUETYoC3ESpbOJODQu+8+i6ZJdk+ZjLuVIbDD+Fvz VrWw2zwvUmUkCU8m2caH9M+pJwe1tu3zoTtTA6F4= Date: Wed, 24 Apr 2024 21:46:03 +0300 From: Laurent Pinchart To: Sakari Ailus Cc: Hans Verkuil , Ricardo Ribalda , 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 Subject: Re: [PATCH v2 09/26] media: v4l: async: refactor v4l2_async_create_ancillary_links Message-ID: <20240424184603.GA6282@pendragon.ideasonboard.com> References: <20240419-fix-cocci-v2-0-2119e692309c@chromium.org> <20240419-fix-cocci-v2-9-2119e692309c@chromium.org> <40b9c015-8ccf-4313-800a-ecae9aa8cc27@xs4all.nl> 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-Disposition: inline In-Reply-To: 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