From: sashiko-bot@kernel.org
To: "Mikko Perttunen" <mperttunen@nvidia.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/6] gpu: host1x: Avoid double device_add when clients already present
Date: Tue, 09 Jun 2026 08:20:32 +0000 [thread overview]
Message-ID: <20260609082032.AF5E61F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260609-b4-host1x-small-fixes-a-v1-2-7c1131c0b3ad@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch prevents a double `device_add()` on the success path, but causes a forbidden second `device_add()` call if the first attempt fails.
--
commit ece8de02ea1a088261ec6c5d40e683d0804f1957
Author: Mikko Perttunen <mperttunen@nvidia.com>
gpu: host1x: Avoid double device_add when clients already present
This commit fixes an issue in host1x_device_add where device_add is called
twice if all subdevs are matched and moved to the active list. It prevents
the second call by checking a registered flag before invoking device_add at
the end of the function.
> diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
> index f814eb4941c02..fe4af98e8fc68 100644
> --- a/drivers/gpu/host1x/bus.c
> +++ b/drivers/gpu/host1x/bus.c
[ ... ]
> @@ -508,7 +508,7 @@ static int host1x_device_add(struct host1x *host1x,
> * Add device even if there are no subdevs to ensure syncpoint functionality
> * is available regardless of whether any engine subdevices are present
> */
> - if (list_empty(&device->subdevs)) {
> + if (list_empty(&device->subdevs) && !device->registered) {
[Severity: High]
Does this cause a forbidden second device_add() call if the first attempt
fails during the subdevice registration flow?
If device_add() is called earlier during host1x_subdev_register() and fails,
device->registered remains false. The execution then continues to this final
block in host1x_device_add().
Since list_empty(&device->subdevs) could evaluate to true and
!device->registered is also true, won't this trigger an immediate second
device_add() on the identically failed structure?
> err = device_add(&device->dev);
> if (err < 0)
> dev_err(&device->dev, "failed to add device: %d\n", err);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260609-b4-host1x-small-fixes-a-v1-0-7c1131c0b3ad@nvidia.com?part=2
next prev parent reply other threads:[~2026-06-09 8:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 8:09 [PATCH 0/6] Miscellaneous fixes for the Host1x driver Mikko Perttunen
2026-06-09 8:09 ` [PATCH 1/6] gpu: host1x: Wait for timeout worker completion on channel free Mikko Perttunen
2026-06-09 8:24 ` sashiko-bot
2026-06-09 8:09 ` [PATCH 2/6] gpu: host1x: Avoid double device_add when clients already present Mikko Perttunen
2026-06-09 8:20 ` sashiko-bot [this message]
2026-06-09 8:09 ` [PATCH 3/6] gpu: host1x: Fix offset calculation in trace_write_gather Mikko Perttunen
2026-06-09 8:26 ` sashiko-bot
2026-06-09 8:09 ` [PATCH 4/6] gpu: host1x: Avoid stack over-read in debug output helpers Mikko Perttunen
2026-06-09 8:09 ` [PATCH 5/6] gpu: host1x: Change pin_job() return type to int Mikko Perttunen
2026-06-09 8:29 ` sashiko-bot
2026-06-09 8:09 ` [PATCH 6/6] gpu: host1x: Annotate intentional syncpoint wrap-around Mikko Perttunen
2026-06-09 8:29 ` sashiko-bot
2026-07-16 18:52 ` [PATCH 0/6] Miscellaneous fixes for the Host1x driver Thierry Reding
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=20260609082032.AF5E61F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=mperttunen@nvidia.com \
--cc=sashiko-reviews@lists.linux.dev \
/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