linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
	Ricardo Ribalda <ribalda@chromium.org>,
	Martin Tuma <martin.tuma@digiteqautomotive.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hugues Fruchet <hugues.fruchet@foss.st.com>,
	Alain Volmat <alain.volmat@foss.st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Sowjanya Komatineni <skomatineni@nvidia.com>,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Sergey Kozlov <serjk@netup.ru>, Abylay Ospan <aospan@netup.ru>,
	Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
	Dmitry Osipenko <digetx@gmail.com>,
	Benjamin Mugnier <benjamin.mugnier@foss.st.com>,
	Sylvain Petinot <sylvain.petinot@foss.st.com>,
	Stanimir Varbanov <stanimir.k.varbanov@gmail.com>,
	Vikash Garodia <quic_vgarodia@quicinc.com>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	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
Date: Wed, 24 Apr 2024 21:46:03 +0300	[thread overview]
Message-ID: <20240424184603.GA6282@pendragon.ideasonboard.com> (raw)
In-Reply-To: <ZilMu614pUAzEGTa@kekkonen.localdomain>

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 <ribalda@chromium.org>
> > > ---
> > >  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

  reply	other threads:[~2024-04-24 18:46 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19  9:47 [PATCH v2 00/26] media: Fix coccinelle warning/errors Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 01/26] media: pci: mgb4: Refactor struct resources Ricardo Ribalda
2024-04-20 23:00   ` Bryan O'Donoghue
2024-04-19  9:47 ` [PATCH v2 02/26] media: stb0899: Simplify check Ricardo Ribalda
2024-04-20 23:07   ` Bryan O'Donoghue
2024-04-19  9:47 ` [PATCH v2 03/26] media: uvcvideo: Refactor iterators Ricardo Ribalda
2024-04-19 10:01   ` Laurent Pinchart
2024-04-19  9:47 ` [PATCH v2 04/26] media: uvcvideo: Use max() macro Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 05/26] media: go7007: Use min and max macros Ricardo Ribalda
2024-04-20 23:11   ` Bryan O'Donoghue
2024-04-19  9:47 ` [PATCH v2 06/26] media: stm32-dcmipp: Remove redundant printk Ricardo Ribalda
2024-04-20 23:15   ` Bryan O'Donoghue
2024-04-22  6:52     ` Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 07/26] media: staging: sun6i-isp: " Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 08/26] media: dvb-frontends: tda18271c2dd: Remove casting during div Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 09/26] media: v4l: async: refactor v4l2_async_create_ancillary_links Ricardo Ribalda
2024-04-20 23:23   ` Bryan O'Donoghue
2024-04-24 10:55   ` Hans Verkuil
2024-04-24 18:17     ` Sakari Ailus
2024-04-24 18:46       ` Laurent Pinchart [this message]
2024-04-29 10:51         ` Ricardo Ribalda
2024-05-04  8:25           ` Hans Verkuil
2024-04-19  9:47 ` [PATCH v2 10/26] staging: media: tegra-video: Use swap macro Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 11/26] media: s2255: Use refcount_t instead of atomic_t for num_channels Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 12/26] media: platform: mtk-mdp3: Use refcount_t for job_count Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 13/26] media: common: saa7146: Use min macro Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 14/26] media: dvb-frontends: drx39xyj: " Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 15/26] media: netup_unidvb: " Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 16/26] media: au0828: " Ricardo Ribalda
2024-04-24 11:03   ` Hans Verkuil
2024-04-19  9:48 ` [PATCH v2 17/26] media: flexcop-usb: " Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 18/26] media: gspca: cpia1: " Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 19/26] media: stk1160: " Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 20/26] media: tegra-vde: Refactor timeout handling Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 21/26] media: i2c: st-mipid02: Use the correct div function Ricardo Ribalda
2024-04-24 18:22   ` Sakari Ailus
2024-04-19  9:48 ` [PATCH v2 22/26] media: tc358746: Use the correct div_ function Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 23/26] media: venus: vdec: Make explicit the range of us_per_frame Ricardo Ribalda
2024-04-20 22:47   ` Bryan O'Donoghue
2024-04-21 13:20   ` Markus Elfring
2024-04-19  9:48 ` [PATCH v2 24/26] media: venus: venc: " Ricardo Ribalda
2024-04-20 22:47   ` Bryan O'Donoghue
2024-04-21 13:25   ` Markus Elfring
2024-04-21 13:48     ` Greg Kroah-Hartman
2024-04-19  9:48 ` [PATCH v2 25/26] media: dvb-frontends: tda10048: Fix integer overflow Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 26/26] media: dvb-frontends: tda10048: Make explicit the range of z Ricardo Ribalda
2024-04-21 14:07   ` Markus Elfring
2024-04-24 11:11 ` [PATCH v2 00/26] media: Fix coccinelle warning/errors Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240424184603.GA6282@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=alain.volmat@foss.st.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andersson@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=aospan@netup.ru \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=digetx@gmail.com \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=gregkh@linuxfoundation.org \
    --cc=hugues.fruchet@foss.st.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=linux-tegra@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=martin.tuma@digiteqautomotive.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=quic_vgarodia@quicinc.com \
    --cc=ribalda@chromium.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=samuel@sholland.org \
    --cc=serjk@netup.ru \
    --cc=skomatineni@nvidia.com \
    --cc=stanimir.k.varbanov@gmail.com \
    --cc=sylvain.petinot@foss.st.com \
    --cc=thierry.reding@gmail.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).