The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v3 1/2] usb: chipidea: ci_hdrc_imx: Propagate errors from optional IRQ lookup
@ 2026-08-10  9:31 phucduc.bui
  2026-08-10  9:31 ` [PATCH v3 2/2] usb: chipidea: ci_hdrc_imx: Fix error handling when creating IRQ name phucduc.bui
  2026-08-10 19:04 ` [PATCH v3 1/2] usb: chipidea: ci_hdrc_imx: Propagate errors from optional IRQ lookup Frank Li
  0 siblings, 2 replies; 3+ messages in thread
From: phucduc.bui @ 2026-08-10  9:31 UTC (permalink / raw)
  To: Peter Chen, Greg Kroah-Hartman, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, linux-usb
  Cc: Fabio Estevam, imx, linux-kernel, linux-arm-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

platform_get_irq_optional() returns a positive IRQ number on success or
a negative error code on failure. For an optional IRQ, -ENXIO indicates
that no IRQ is available, while other errors should be propagated.

Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing
probe without the IRQ.

Acked-by: Peter Chen <peter.chen@kernel.org>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---

Link v2: 
https://lore.kernel.org/all/20260807065619.30604-1-phucduc.bui@gmail.com/
Changes in v3:
 - Use the phy_shutdown label instead of err_clk as suggested by 
   Sashiko's review. 
 - Add Peter Chen's Acked-by tag.

 drivers/usb/chipidea/ci_hdrc_imx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 56d2ba824a0b..9e529398c607 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -525,6 +525,10 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
 		data->supports_runtime_pm = true;
 
 	data->wakeup_irq = platform_get_irq_optional(pdev, 1);
+	if (data->wakeup_irq < 0 && data->wakeup_irq != -ENXIO) {
+		ret = data->wakeup_irq;
+		goto phy_shutdown;
+	}
 	if (data->wakeup_irq > 0) {
 		irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s:wakeup", pdata.name);
 		if (!irq_name) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v3 2/2] usb: chipidea: ci_hdrc_imx: Fix error handling when creating IRQ name
  2026-08-10  9:31 [PATCH v3 1/2] usb: chipidea: ci_hdrc_imx: Propagate errors from optional IRQ lookup phucduc.bui
@ 2026-08-10  9:31 ` phucduc.bui
  2026-08-10 19:04 ` [PATCH v3 1/2] usb: chipidea: ci_hdrc_imx: Propagate errors from optional IRQ lookup Frank Li
  1 sibling, 0 replies; 3+ messages in thread
From: phucduc.bui @ 2026-08-10  9:31 UTC (permalink / raw)
  To: Peter Chen, Greg Kroah-Hartman, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, linux-usb
  Cc: Fabio Estevam, imx, linux-kernel, linux-arm-kernel, bui duc phuc,
	Sashiko Bot

From: bui duc phuc <phucduc.bui@gmail.com>

devm_kasprintf() can fail when allocating the wakeup IRQ name. The error
was logged with dev_err_probe(), but its return value was ignored and
probe could continue with a successful return value.

Store the error returned by dev_err_probe() in ret and jump to the error
path to propagate the failure.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Peter Chen <peter.chen@kernel.org>
Reported-by: Sashiko Bot <sashiko-bot@kernel.org>
Link: https://lore.kernel.org/all/20260806065755.C9F361F000E9@smtp.kernel.org/
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---

Link v2: 
https://lore.kernel.org/all/20260807065619.30604-2-phucduc.bui@gmail.com/
Changes in v3:
 - Use the phy_shutdown label instead of err_clk as suggested by 
   Sashiko's review. 
 - Add Peter Chen's Acked-by tag.
 - Add Frank Li's Reviewed-by tag.

 drivers/usb/chipidea/ci_hdrc_imx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 9e529398c607..edbf9df9b8f2 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -532,8 +532,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
 	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");
-			goto err_clk;
+			ret = dev_err_probe(dev, -ENOMEM, "failed to create irq_name\n");
+			goto phy_shutdown;
 		}
 
 		ret = devm_request_threaded_irq(dev, data->wakeup_irq,
@@ -541,7 +541,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
 						IRQF_ONESHOT | IRQF_NO_AUTOEN,
 						irq_name, data);
 		if (ret)
-			goto err_clk;
+			goto phy_shutdown;
 	}
 
 	ret = imx_usbmisc_init(data->usbmisc_data);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 1/2] usb: chipidea: ci_hdrc_imx: Propagate errors from optional IRQ lookup
  2026-08-10  9:31 [PATCH v3 1/2] usb: chipidea: ci_hdrc_imx: Propagate errors from optional IRQ lookup phucduc.bui
  2026-08-10  9:31 ` [PATCH v3 2/2] usb: chipidea: ci_hdrc_imx: Fix error handling when creating IRQ name phucduc.bui
@ 2026-08-10 19:04 ` Frank Li
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2026-08-10 19:04 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Peter Chen, Greg Kroah-Hartman, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, linux-usb, Fabio Estevam, imx,
	linux-kernel, linux-arm-kernel

On Mon, Aug 10, 2026 at 04:31:11PM +0700, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> platform_get_irq_optional() returns a positive IRQ number on success or
> a negative error code on failure. For an optional IRQ, -ENXIO indicates
> that no IRQ is available, while other errors should be propagated.
>
> Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing
> probe without the IRQ.
>
> Acked-by: Peter Chen <peter.chen@kernel.org>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>
> Link v2:
> https://lore.kernel.org/all/20260807065619.30604-1-phucduc.bui@gmail.com/
> Changes in v3:
>  - Use the phy_shutdown label instead of err_clk as suggested by
>    Sashiko's review.
>  - Add Peter Chen's Acked-by tag.
>
>  drivers/usb/chipidea/ci_hdrc_imx.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> index 56d2ba824a0b..9e529398c607 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> @@ -525,6 +525,10 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
>  		data->supports_runtime_pm = true;
>
>  	data->wakeup_irq = platform_get_irq_optional(pdev, 1);
> +	if (data->wakeup_irq < 0 && data->wakeup_irq != -ENXIO) {
> +		ret = data->wakeup_irq;
> +		goto phy_shutdown;
> +	}
>  	if (data->wakeup_irq > 0) {
>  		irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s:wakeup", pdata.name);
>  		if (!irq_name) {
> --
> 2.43.0
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-10 19:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-10  9:31 [PATCH v3 1/2] usb: chipidea: ci_hdrc_imx: Propagate errors from optional IRQ lookup phucduc.bui
2026-08-10  9:31 ` [PATCH v3 2/2] usb: chipidea: ci_hdrc_imx: Fix error handling when creating IRQ name phucduc.bui
2026-08-10 19:04 ` [PATCH v3 1/2] usb: chipidea: ci_hdrc_imx: Propagate errors from optional IRQ lookup Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox