From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ib1fefbo" 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-tegra@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