From: Dan Carpenter <error27@gmail.com>
To: Luca Ceresoli <luca.ceresoli@bootlin.com>
Cc: Hao-Qun Huang <alvinhuang0603@gmail.com>,
Sowjanya Komatineni <skomatineni@nvidia.com>,
Thierry Reding <thierry.reding@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-media@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: media: tegra-video: vi: fix probe failure on skipped last port
Date: Mon, 27 Jul 2026 19:21:21 +0300 [thread overview]
Message-ID: <ameFgX4p_UvO0DiD@stanley.mountain> (raw)
In-Reply-To: <DK9B2RGTKZE4.BHXZNRMJ4PWK@bootlin.com>
On Mon, Jul 27, 2026 at 01:10:07PM +0200, Luca Ceresoli wrote:
> Hello,
>
> On Tue Jul 7, 2026 at 5:24 PM CEST, Hao-Qun Huang wrote:
> > tegra_vi_channels_alloc() iterates over port nodes and skips those
> > whose reg property cannot be read or whose remote endpoint fails
> > v4l2_fwnode_endpoint_parse(), leaving the negative result of the
> > failed call in ret. If that happens on the last port node, the loop
> > ends with ret still negative and tegra_vi_init() fails the whole VI
> > probe.
> >
> > The same defective port earlier in the ports node is skipped silently,
> > so probing succeeds or fails depending on the order of the port nodes.
> > The CSI equivalent, tegra_csi_channels_alloc(), returns 0
> > unconditionally after its loop and does not have this problem.
> >
> > Use a separate variable for the per-port checks so that only fatal
> > errors end up in ret.
> >
> > Fixes: 1ebaeb09830f ("media: tegra-video: Add support for external sensor capture")
> > Fixes: 2ac4035a78c9 ("media: tegra-video: Add support for x8 captures with gang ports")
> > Assisted-by: Claude:claude-fable-5
> > Signed-off-by: Hao-Qun Huang <alvinhuang0603@gmail.com>
>
> Do you have a real use case where ths failure happens?
>
> Also, mixing two different return values may solve a bug but makes for more
> intricated. I'd rather second a fix based on moving the whole foreach loop
> body into a subfunction, and make the foreach loop body as simple as
> calling the subfunction and handling returned errors. This would fix the
> code making it more readbale.
My instinct is that the continues should just be exits... Why are we
accepting broken device trees?
regards,
dan carpenter
next prev parent reply other threads:[~2026-07-27 16:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 15:24 [PATCH] staging: media: tegra-video: vi: fix probe failure on skipped last port Hao-Qun Huang
2026-07-27 11:10 ` Luca Ceresoli
2026-07-27 16:21 ` Dan Carpenter [this message]
2026-07-27 12:43 ` Hao-Qun Huang
2026-07-27 13:34 ` Luca Ceresoli
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=ameFgX4p_UvO0DiD@stanley.mountain \
--to=error27@gmail.com \
--cc=alvinhuang0603@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-tegra@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=mchehab@kernel.org \
--cc=skomatineni@nvidia.com \
--cc=thierry.reding@kernel.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