Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp727397lqd; Wed, 24 Apr 2024 15:22:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8/uUJNJLQ69gOtqhrbqa4MWhvdqCTk9E96BpTqmS6c90JDUlwFNgl4ktTS2o+Dx9XZbTVadENg+KstyV4QR0EpuJkVv8cdNK901Nc2Q== X-Google-Smtp-Source: AGHT+IEfN2QyLAPmKUX6nwK43ff4d4s1OJCkBGvetqwag1zx0FDuWBRA4V9s8UDk0rNeg2yw0bwE X-Received: by 2002:a17:903:2302:b0:1e1:6850:f823 with SMTP id d2-20020a170903230200b001e16850f823mr4847402plh.13.1713997379291; Wed, 24 Apr 2024 15:22:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713997379; cv=pass; d=google.com; s=arc-20160816; b=JlLx7ixX6OgDG6sn6nJ76ugihvRZEY2zngwZpDGf8pFlJ8LBXqulXaN2e3lYlhBphI lyU5rnAE2Zps96X0FQcmKetlDg8Nb0VH1P0ZsyR13oAvxLkQhu10pmvI7wJ/rCDjWxdh pAytSxuBQohldbYuckYAMyShc0VXCbg6zUHrWUFdH8LNj4PAFeDSirBeDIjipmh+g/B/ snaYvD0XpPvh7QfwA2XYHicpluvT9+ZqJ24JbQOaRCPMlZirze+Pp9BJ3TxmhHHffqMR HVDUh6gg1dwnQy0ULWtHz37ZyHBFqZ7+7q9H04WESS/GZ0219l4ThAnx3WdlYTH/oVw4 toWA== 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=1AHgfTpF3cLHSAeDsd1TA/pt5hql/fCtz0ijoVnYJbI=; fh=bzUJv7LC/496GTRVwDe4c9HWmCPhvTk37XX0NIY2sy0=; b=r6s5dFqCWB5BnDOAGMqmCU9gFteh2I/DV3+D684XyPF1duFjFjH5DVwkuz2oNUHsrP zOVuceQNf/2uAAZoKh8MHMJyV7vI51y4JG2OSilmHH2jc9aM9Bt8Fp8j1vZr61tjA3vT hq/ZVtC9v1rAHbAuvtg5rby7jNcjDfonCx0GDt3GMxq3NIZDhBSucpyr6d3NZO18SlAx RgbNAHACh7JFNAXTRItOvpVPjAGO3DFgI6fUPKIkKyHTm8CqxmE29afqZy82E9BZXYTt pYIwu53LwK0QBihjc+ewzTQ2Bqzr+Q8s4Kb8xTo/Ki00O+nXPiDULxBokTibGbZo7Dcr qctw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ib1fefbo; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-157522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c10-20020a170902724a00b001e431e864ebsi11637527pll.342.2024.04.24.15.22.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 15:22:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ib1fefbo; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-157522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1D1B428D1E9 for ; Wed, 24 Apr 2024 18:30:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA8FF16DEC1; Wed, 24 Apr 2024 18:17:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ib1fefbo" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 8D5FF16D9D6; Wed, 24 Apr 2024 18:17:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713982665; cv=none; b=uE9ZmPTqPXGTTJcFTffrm0IIjCz9+Crrlh7AaljJHpEdQLNRzZEEBwV7PpB6Lp2mm9WUa6CKtbrBIOUfS42Bdk+qchh0SvB0C4M6h6oXHYQEEeU3txDekJuwB2c+VWQowYxf6/y9wBy+gt4mQHHGpU9nFzn+ZelF2HuyAFu709o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713982665; c=relaxed/simple; bh=7xkLBBaXS/ts3U0e/eGzzgm9XxfKNOK2obmaTlvSKJQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=W3B2dZ/axpBUDas3i50+aMtqeWrbZVwDnaGqLwTR6DBaskcZiuAZ8RloErP1OGfZ01srxeEO+cDca0xl3V78JrxcAYiNxm8XPCrSzz/v9VkgabXwAA7nEvZtV7VOKAJtP22zn+mGneq29PLG34BTe3ZIqLhHMZx6Xf0SRlcGryM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ib1fefbo; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713982662; x=1745518662; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=7xkLBBaXS/ts3U0e/eGzzgm9XxfKNOK2obmaTlvSKJQ=; b=ib1fefboxOUDctCIpib9X8Z415agBUtMpBakRAWHeejxqL6RA4/sr6va H0FldPjtVQm/jvxL0cpTJrt2l/uP6kuD0QghxLYMiLfngh5UlG0ocDejz h11MInOfUAlsutuSid97fMgRBJpmQET2HPkTjDLqnpw0Sg75rh/YyVRl8 ajlNBWcHjqvlHRsON88WmlG/j/jwE0TaRp1GmzLiroRTKlm5tK+G/K1EE 5gwfBtJmy3CuehTl7l66/KEEwRZ+VWzCqLy9n82ZN2Xg9e6ilz6RINA/4 Xolu8sZNEhFookdW/JF+o2oAMcTpWe2Rl876sGblACFn3LPfobV+GFO3c g==; X-CSE-ConnectionGUID: DUkMIiiwR2GJvRV1vlUZAA== X-CSE-MsgGUID: 0fHHtLllQTOv0rkFFurkBw== X-IronPort-AV: E=McAfee;i="6600,9927,11054"; a="10169224" X-IronPort-AV: E=Sophos;i="6.07,226,1708416000"; d="scan'208";a="10169224" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2024 11:17:41 -0700 X-CSE-ConnectionGUID: kTFwy/phR+KWMlgyOhnMww== X-CSE-MsgGUID: 8tONyMQGRoWni1myd2XIFg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,226,1708416000"; d="scan'208";a="24864024" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2024 11:17:33 -0700 Received: from kekkonen.localdomain (localhost [127.0.0.1]) by kekkonen.fi.intel.com (Postfix) with SMTP id 7403011F855; Wed, 24 Apr 2024 21:17:31 +0300 (EEST) Date: Wed, 24 Apr 2024 18:17:31 +0000 From: Sakari Ailus To: Hans Verkuil Cc: 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 , 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: 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=us-ascii Content-Disposition: inline In-Reply-To: <40b9c015-8ccf-4313-800a-ecae9aa8cc27@xs4all.nl> Hi Hans, 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. -- Regards, Sakari Ailus