From: sashiko-bot@kernel.org
To: "Fil Dunsky" <filipp.dunsky@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 2/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller
Date: Tue, 17 Nov 2026 20:52:13 +0000 [thread overview]
Message-ID: <sashiko-outbox-219661@kernel.org> (raw)
In-Reply-To: <20261117-cs75xx-intc-v4-2-0a678f35e5f3@gmail.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] irqchip: CS75XX_INTC uses undefined ARCH_CORTINA_ACCESS and
lacks HAS_IOMEM
- [Medium] irqchip: cs75xx: missing IRQ_LEVEL and wrong IRQ_NOPROBE in
cs75xx_intc_init()
- [Medium] irqchip: cs75xx: leaked MMIO region reservation in
cs75xx_intc_init()
--
commit 57fad06ce5781b2c6a356fbbe01aad10d8c69bd9
Author: Fil Dunsky <filipp.dunsky@gmail.com>
irqchip: Add Cortina Systems CS75xx peripheral interrupt controller
This commit adds a chained interrupt controller driver for the low-speed
peripheral interrupt combiner on Cortina Systems CS75xx SoCs.
> diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
> index 136bab41f8011..db5edd4ec0927 100644
> --- a/drivers/irqchip/Kconfig
> +++ b/drivers/irqchip/Kconfig
> @@ -187,6 +187,18 @@ config BRCMSTB_L2_IRQ
> select GENERIC_IRQ_CHIP
> select IRQ_DOMAIN
>
> +config CS75XX_INTC
> + bool "Cortina Systems CS75xx peripheral interrupt controller"
> + depends on ARCH_CORTINA_ACCESS || COMPILE_TEST
> + default ARCH_CORTINA_ACCESS
> + select GENERIC_IRQ_CHIP
> + select IRQ_DOMAIN
[Severity: Medium]
Is ARCH_CORTINA_ACCESS defined anywhere in the tree, and does CS75XX_INTC
need to depend on HAS_IOMEM?
Because ARCH_CORTINA_ACCESS is not defined in any Kconfig file,
CS75XX_INTC cannot be enabled without COMPILE_TEST and its default always
evaluates to n. In addition, enabling CS75XX_INTC under COMPILE_TEST on
architectures without HAS_IOMEM (such as s390 with PCI disabled) fails to
build in cs75xx_intc_init() due to an implicit declaration of iounmap().
[ ... ]
> diff --git a/drivers/irqchip/irq-cs75xx.c b/drivers/irqchip/irq-cs75xx.c
> new file mode 100644
> index 0000000000000..f3d71b06c59de
> --- /dev/null
> +++ b/drivers/irqchip/irq-cs75xx.c
> @@ -0,0 +1,100 @@
[ ... ]
> +static int __init cs75xx_intc_init(struct device_node *np, struct device_node *parent)
> +{
> + struct irq_chip_generic *gc;
> + struct irq_domain *domain;
> + void __iomem *base;
> + int parent_irq;
> + int ret;
> +
> + base = of_io_request_and_map(np, 0, of_node_full_name(np));
> + if (IS_ERR(base)) {
> + pr_err("%pOF: unable to map registers\n", np);
> + return PTR_ERR(base);
> + }
> +
> + /* Mask everything before the chained handler is installed */
> + writel(0, base + CS75XX_INTC_ENABLE);
> +
> + parent_irq = irq_of_parse_and_map(np, 0);
> + if (!parent_irq) {
> + pr_err("%pOF: unable to map parent interrupt\n", np);
> + ret = -EINVAL;
> + goto err_unmap;
> + }
> +
> + domain = irq_domain_create_linear(of_fwnode_handle(np), CS75XX_INTC_NR_IRQS,
> + &irq_generic_chip_ops, NULL);
> + if (!domain) {
> + ret = -ENOMEM;
> + goto err_dispose;
> + }
> +
> + ret = irq_alloc_domain_generic_chips(domain, CS75XX_INTC_NR_IRQS, 1, "cs75xx-intc",
> + handle_level_irq, IRQ_NOREQUEST | IRQ_NOPROBE, 0,
> + IRQ_GC_INIT_MASK_CACHE);
[Severity: Medium]
Should irq_alloc_domain_generic_chips() set IRQ_LEVEL | IRQ_NOPROBE in the
set argument instead of passing 0 and clearing IRQ_NOPROBE?
Because the interrupt specifiers have no trigger type cell and the chip
does not implement .irq_set_type(), leaving IRQ_LEVEL out of the set flags
means _IRQ_LEVEL and IRQD_LEVEL are never set on the mapped descriptors.
As a result, check_irq_resend() treats these level interrupts as
edge-triggered during enable_irq() and schedules software resends via
irq_sw_resend(). Passing IRQ_NOPROBE in the clear mask also makes the
interrupts probeable instead of preventing probing.
> + if (ret)
> + goto err_domain;
> +
> + gc = irq_get_domain_generic_chip(domain, 0);
> + gc->reg_base = base;
> + gc->chip_types[0].regs.mask = CS75XX_INTC_ENABLE;
> + gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit;
> + gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit;
> +
> + irq_set_chained_handler_and_data(parent_irq, cs75xx_intc_handler, domain);
> +
> + return 0;
> +
> +err_domain:
> + irq_domain_remove(domain);
> +err_dispose:
> + irq_dispose_mapping(parent_irq);
> +err_unmap:
> + iounmap(base);
> + return ret;
> +}
[Severity: Medium]
Does the err_unmap path leak the memory region reserved by
of_io_request_and_map()?
of_io_request_and_map() reserves the physical range via
request_mem_region() before mapping it, and iounmap() only drops the
virtual mapping, leaving the region permanently reserved in iomem_resource
if initialization fails. Using of_iomap() or releasing the region on
error would avoid the leak.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-cs75xx-intc-v4-0-0a678f35e5f3@gmail.com?part=2
prev parent reply other threads:[~2026-11-17 20:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 20:29 [PATCH v4 0/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller Fil Dunsky
2026-11-17 20:29 ` Fil Dunsky via B4 Relay
2026-11-17 20:29 ` [PATCH v4 1/2] dt-bindings: interrupt-controller: Add Cortina Systems CS7542 " Fil Dunsky
2026-11-17 20:29 ` Fil Dunsky via B4 Relay
2026-11-17 20:29 ` [PATCH v4 2/2] irqchip: Add Cortina Systems CS75xx " Fil Dunsky
2026-11-17 20:29 ` Fil Dunsky via B4 Relay
2026-11-17 20:52 ` 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-219661@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=filipp.dunsky@gmail.com \
--cc=robh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.