Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tian Xuechen" <202300460064@mail.sdu.edu.cn>
Cc: linux-gpio@vger.kernel.org
Subject: Re: [PATCH] gpio: pxa: Publish the legacy IRQ domain after GPIO setup succeeds
Date: Sun, 29 Nov 2026 10:01:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-239483@kernel.org> (raw)
In-Reply-To: <20261129094739.1691742-1-202300460064@mail.sdu.edu.cn>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] gpio: pxa: NULL pointer dereference in pxa_gpio_probe_dt() [1]
--

commit b66797fa4e010f68c27fe464b77da0fdb10324ea
Author: Tian Xuechen <202300460064@mail.sdu.edu.cn>

gpio: pxa: Publish the legacy IRQ domain after GPIO setup succeeds

This commit creates the legacy IRQ domain after GPIO chip registration
succeeds, uses devm_gpiochip_add_data(), and disables manual driver unbind.

> diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
> index 17e95ee4fef64..1689a05da6c95 100644
> --- a/drivers/gpio/gpio-pxa.c
> +++ b/drivers/gpio/gpio-pxa.c

[ ... ]

> @@ -637,11 +645,6 @@ static int pxa_gpio_probe(struct platform_device *pdev)
>  	if (!pxa_last_gpio)
>  		return -EINVAL;
>  
> -	pchip->irqdomain = irq_domain_create_legacy(dev_fwnode(&pdev->dev), pxa_last_gpio + 1,
> -						    irq_base, 0, &pxa_irq_domain_ops, pchip);
> -	if (!pchip->irqdomain)
> -		return -ENOMEM;
> -

[Severity: High]
This problem wasn't introduced by this patch, but can pxa_gpio_probe() ->
pxa_gpio_probe_dt() cause a NULL pointer dereference [1] on a non-DT
platform device without platform data?

When dev_get_platdata() returns NULL, pxa_gpio_probe() falls back to
pxa_gpio_probe_dt(), which dereferences the result of
of_device_get_match_data() without checking for NULL:

drivers/gpio/gpio-pxa.c:pxa_gpio_probe_dt() {
	...
	gpio_id = of_device_get_match_data(&pdev->dev);
	gpio_type = gpio_id->type;
	...
}

[1] https://sashiko.dev/#/bug/linux-ddf1292a-99b3-45e7-9575-418a500c6bcf

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261129094739.1691742-1-202300460064@mail.sdu.edu.cn?part=1

      reply	other threads:[~2026-11-29 10:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  9:47 [PATCH] gpio: pxa: Publish the legacy IRQ domain after GPIO setup succeeds Tian Xuechen
2026-11-29 10:01 ` sashiko-bot [this message]

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=sashiko-outbox-239483@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=202300460064@mail.sdu.edu.cn \
    --cc=linux-gpio@vger.kernel.org \
    --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