mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sahaj Chaudhari <sahaj123.sc@gmail.com>
To: linusw@kernel.org, brgl@kernel.org
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	j-keerthy@ti.com, nsekhar@ti.com, prabhakar.csengg@gmail.com,
	avinashphilip@ti.com, sujithkv@ti.com
Subject: [PATCH v2 0/2] gpio: davinci: fix probe-time IRQ setup
Date: Tue, 24 Nov 2026 19:06:52 +0530	[thread overview]
Message-ID: <20261124121500.2cd5cbf30f89-1-sahaj123.sc@gmail.com> (raw)

This series fixes two independent probe-time bugs in the DaVinci GPIO
driver:

1. A file-global MMIO base can be overwritten by overlapping controller
   probes, causing BINTEN setup to target the wrong controller.
2. Per-bank IRQ data is allocated as chained handlers are installed. A
   later allocation failure can leave handlers pointing to devm-managed
   data freed during probe unwind.

The first patch derives BINTEN from the current controller's mapped bank.
The second allocates all IRQ data before installing any handlers.

---
Changes in v2:
- Rebase on current GPIO gpio/for-next, incorporating the upstream
  devm_kzalloc_obj() conversion as requested by Bartosz.
- Use devm_kzalloc_objs() for the upfront bank-data array in patch 2.
- Add Linus Walleij's Reviewed-by to both patches.
- Keep the pre-existing GPIO-count bounds issue reported by Sashiko
  separate, as requested by Linus.
- Repeat baseline/fixed fault regressions and parent-handler dispatch
  coverage on AM642.

Previous version:
https://lore.kernel.org/all/20261109194910.2282454-1-sahaj123.sc@gmail.com/

Testing:
- ARM64 W=1 driver builds passed for each fix and the series.
- A local ASan/UBSan harness ran the extracted probe and IRQ setup
  functions with mocked allocation, IRQ registration and 32-bit MMIO.
  Nested probes of 87/88-GPIO controllers and bank-allocation failures
  reproduced wrong targets and stale handlers; each fix passed
  independently.
- On AM642, instrumented baseline/fixed kernels reproduced wrong BINTEN
  targets and a stale chained handler under forced probe interleaving and
  allocation failure; the fixes passed. A private module also exercised
  the real parent handler on 12 banks via GIC pending-state injection.
  No electrical GPIO edges or child IRQ delivery were tested.

The AM642 tests used kernels with extra debug code to force these
failures; that code is not part of this series. On those 7.4 test
kernels, with and without the fixes, the mmio-mux driver at a40000
failed to probe with -22 using the vendor device tree. The board's
6.12 vendor kernel does not show this error. I have not found the
cause, so these runs were not a full-board check.

GitHub Copilot CLI was used during bug investigation, review, patch
preparation and testing, and to draft the emails and commit messages.

Sahaj Chaudhari (2):
  gpio: davinci: use controller-specific MMIO for BINTEN
  gpio: davinci: allocate bank IRQ data before installing handlers

 drivers/gpio/gpio-davinci.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)


base-commit: 0e1941b7d0b0a0405b16567678a9bc3b20be6340
-- 
2.43.0


             reply	other threads:[~2026-11-24 13:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 13:36 Sahaj Chaudhari [this message]
2026-11-24 13:36 ` [PATCH v2 1/2] gpio: davinci: use controller-specific MMIO for BINTEN Sahaj Chaudhari
2026-11-24 13:36 ` [PATCH v2 2/2] gpio: davinci: allocate bank IRQ data before installing handlers Sahaj Chaudhari

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=20261124121500.2cd5cbf30f89-1-sahaj123.sc@gmail.com \
    --to=sahaj123.sc@gmail.com \
    --cc=avinashphilip@ti.com \
    --cc=brgl@kernel.org \
    --cc=j-keerthy@ti.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=prabhakar.csengg@gmail.com \
    --cc=sujithkv@ti.com \
    /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

all inboxes | Powered by JetHome®