Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp330808lqd; Wed, 24 Apr 2024 03:55:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVbDwaLkdXi5NaDRZhH5uCfDvT6UpP19uN1d+Xw6vbW3fIwGxRY7rGTDWFalUnbiKPaIxdcgvQ2LQrA0L7d/eBSSQqsDmqvLc0Wc7eAnA== X-Google-Smtp-Source: AGHT+IG4otjQxkxku7OUFLRFNAdum620AdvNlKjViHniyBC7HIiGAKEej/HXtbTIh8larqY8RA3F X-Received: by 2002:a17:906:4146:b0:a58:a108:31df with SMTP id l6-20020a170906414600b00a58a10831dfmr311852ejk.7.1713956143474; Wed, 24 Apr 2024 03:55:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713956143; cv=pass; d=google.com; s=arc-20160816; b=NUasp9qIDRkDWKCOj8tjm8OhUhmS5YXLL8CP8k6cqwXtfwi3zqnIyKbQKknl7DeZyg ATCGRcDWKbNfsLzSACzNOE3HfM+49S6Ah3sV6sfebTE2wrFm/P1HoFCD3fm5bQFO9B0W nPisMJO4eOYjK8q9dAomI1JKVs124SDM6QQoMQQsxAWrLX335H7vlYg7CnoeQze67NrU 5rz4SLzuAvfEV3RLHQUQZU/Tsnm8bUBlsBLULEBREwICmInQ0jdFjEmfwHNEksxK0BKU 1/WQuydHq06D0zZ8c+wtJBEL3Rj6TVZt2wlhV8zzqrpulPB/+m/Urit70Ku7zeeQnUWK oOwA== 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=GT7TJaVQQontWxYWGBylc8lFb0L7XGXXi7iE2XjaLgc=; fh=eVTj75UywcoJpWjM5FasZ2buvdk8E/NrS+0WJ/j6joU=; b=xsKnixyjkrGFUi8izwW/7E2nT9QruGefWxOEg3Jtud2DHrrfgffLwd9X10dOnBiXQO QRVDdyOuVshvzhdi3TGk3vRQ4Vl30ho3I/cmqaFDUlEAOGyrBSCE4nBVdGy1oyb+yhMR WAY8wL3DF2gW21jgAJRrCUOg3G0qdRWzij4/rDsSA4DHBm1cl4wwh3H/f9xyWqRJa9RE afkX1VwqKNukoOdRl3CSOMRM9o4jVRrDRZUiVqtRZfkGm5B44P2V1WnxkwWAqcxXQzad P/f8uc6a2bZSPKRo0zFKPs4O/wYgRWCHiMWvLWwXS3Oo4rGVV+jME0X8PIA6UlbHrSGF jVVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-156759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156759-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id re26-20020a170906d8da00b00a4df3b2356dsi8388124ejb.246.2024.04.24.03.55.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 03:55:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-156759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156759-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0C87E1F23F2A for ; Wed, 24 Apr 2024 10:55:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E532159913; Wed, 24 Apr 2024 10:55:31 +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 6D630152E0B; Wed, 24 Apr 2024 10:55:30 +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=1713956130; cv=none; b=qeFji48EQTRsBc95GUdyVQPch+p01osSMFqSw1HZ50OQCWBQnUgOUMvPkXixOhRHduc0QD6hlzdwmW48cuChZOfrqvrk8GSFu6sRw75zGJeUrbtcNMM4l4JtLzZPYapbKL+1mx5W23I/CUgHh528xfDWh0sSI/NlzgV62HBeVYg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713956130; c=relaxed/simple; bh=8EIqdkMcJTVXvZ2JCnilmnaezsigKpxKdXWJDJFRgUE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=R6FwFVeuWMABo2iS25Fro4TmVTt95Ox6HE6jOaYJARFkgH23e1YQ7vGIXBHcRsRyn2dQd0nuh8rzUUmBspz0vQJ8DQqw037XgBeFP3uhSUwHgCItbjAGKapHNZSuYNy2ZU+HHGZkNkRRUAsXo8+dXhiAZ9TnQf1gaq40H82U8VE= 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 6F6C1C113CE; Wed, 24 Apr 2024 10:55:22 +0000 (UTC) Message-ID: <40b9c015-8ccf-4313-800a-ecae9aa8cc27@xs4all.nl> Date: Wed, 24 Apr 2024 12:55:20 +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 , Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , Hugues Fruchet , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Paul Kocialkowski , Greg Kroah-Hartman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sakari Ailus , 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 Cc: 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> From: Hans Verkuil Autocrypt: addr=hverkuil@xs4all.nl; keydata= xsFNBFQ84W0BEAC7EF1iL4s3tY8cRTVkJT/297h0Hz0ypA+ByVM4CdU9sN6ua/YoFlr9k0K4 BFUlg7JzJoUuRbKxkYb8mmqOe722j7N3HO8+ofnio5cAP5W0WwDpM0kM84BeHU0aPSTsWiGR yw55SOK2JBSq7hueotWLfJLobMWhQii0Zd83hGT9SIt9uHaHjgwmtTH7MSTIiaY6N14nw2Ud C6Uykc1va0Wqqc2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Gt1Itkuu 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: <20240419-fix-cocci-v2-9-2119e692309c@chromium.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 } Regards, Hans