Re: [PATCH] usb: chipidea: ci_hdrc_imx: Propagate -EPROBE_DEFER from IRQ lookup

Bui Duc Phuc <[email protected]>
Newsgroups gmane.linux.usb.general,gmane.linux.kernel,gmane.linux.ports.arm.kernel
Message-ID <CAABR9nEfPqXAt8wDo597qDS3b3KMaHeF6-swAFg9RLanapDnBQ@mail.gmail.com>
Hi Greg,

Thank you for your feedback.

> > From: bui duc phuc <[email protected]>
>
> All lower case?
>

Yes, I’ll keep it lowercase.

> > Return -EPROBE_DEFER from platform_get_irq_optional() so the driver is
> > re-probed when the interrupt resource becomes available instead of
> > continuing probe without an IRQ.
>
> How was this found and tested?
>

I found this during code inspection while cleaning up probe functions in
the Rockchip ASoC drivers.

https://lore.kernel.org/all/20260806052136.21034-1-phucduc.bui-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org/

platform_get_irq_optional() returns a positive IRQ number on success or
a negative error code on failure, including -EPROBE_DEFER. The driver
handled positive IRQ numbers but ignored -EPROBE_DEFER, continuing
probe without an IRQ instead of deferring.

I only compile-tested the change. I don't have the hardware to test this
path at runtime.

While reviewing this,I noticed that -EINVAL also deserves to be returned,
not just -EPROBE_DEFER only -ENXIO really means "no IRQ".
I’ll update this to:

if (data->wakeup_irq < 0 && data->wakeup_irq != -ENXIO) {
        ret = data->wakeup_irq;
        goto err_clk;
}

I also found another issue in the same area:

        if (data->wakeup_irq > 0) {
                irq_name = devm_kasprintf(dev, GFP_KERNEL,
"%s:wakeup", pdata.name);
                if (!irq_name) {
-                       dev_err_probe(dev, -ENOMEM, "failed to create
irq_name\n");
+                       ret = dev_err_probe(dev, -ENOMEM, "failed to
create irq_name\n");
                        goto err_clk;
                }


the error return from dev_err_probe() was not assigned to ret,  so the
error path could still return 0.
I’ll send v2 soon.

Best regards,
Phuc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.