All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Damon Ding" <damon.ding@rock-chips.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 02/14] drm/bridge: analogix_dp: Check all negative return values for &analogix_dp_device.irq
Date: Mon, 19 Oct 2026 09:04:27 +0000	[thread overview]
Message-ID: <sashiko-outbox-176864@kernel.org> (raw)
In-Reply-To: <20261019085836.3065008-3-damon.ding@rock-chips.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/bridge: analogix_dp: unsigned dp->irq < 0 check in analogix_dp_probe()
--

commit fcbed20d54db2072c70e2845510fbc672a7f0240
Author: Damon Ding <damon.ding@rock-chips.com>

drm/bridge: analogix_dp: Check all negative return values for &analogix_dp_device.irq

This commit updates analogix_dp_probe() to check for any negative return
value in dp->irq rather than only -ENXIO, and propagates the error code
instead of returning -ENODEV.

Link: https://lore.kernel.org/all/20260804083307.84ECA1F000E9@smtp.kernel.org/

> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 079f2f01f33b0..27c9a764e25fa 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -1480,9 +1480,9 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
>  		irq_flags = IRQF_NO_AUTOEN;
>  	}
>  
> -	if (dp->irq == -ENXIO) {
> +	if (dp->irq < 0) {
>  		dev_err(&pdev->dev, "failed to get irq\n");
> -		return ERR_PTR(-ENODEV);
> +		return ERR_PTR(dp->irq);
>  	}
>  
>  	ret = devm_request_threaded_irq(&pdev->dev, dp->irq,

[Severity: High]
Can dp->irq < 0 ever be true here? In struct analogix_dp_device in
drivers/gpu/drm/bridge/analogix/analogix_dp_core.h, irq is declared as
unsigned int:

struct analogix_dp_device {
	...
	struct clk		*clock;
	unsigned int		irq;
	void __iomem		*reg_base;

When gpiod_to_irq() or platform_get_irq() returns a negative error code
(such as -EPROBE_DEFER, -ENOENT, or -ENXIO) in analogix_dp_probe(), the
value is stored in the unsigned dp->irq field.

Because dp->irq is unsigned, the dp->irq < 0 comparison is always false.
All negative error codes bypass this check and are passed as large
unsigned values to devm_request_threaded_irq(), which fails with -EINVAL
instead of propagating the original error code (breaking probe deferral).
Additionally, on 64-bit systems, passing an unsigned int to ERR_PTR()
zero-extends it to long rather than sign-extending it.

Would it make sense to change irq to int in struct analogix_dp_device, or
assign the return value of gpiod_to_irq() and platform_get_irq() to ret
first and check ret < 0 before storing it in dp->irq?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261019085836.3065008-1-damon.ding@rock-chips.com?part=2

  reply	other threads:[~2026-10-19  9:05 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  8:58 [PATCH v4 00/14] Add HPD support for Rockchip Analogix DP Damon Ding
2026-10-19  8:58 ` Damon Ding
2026-10-19  8:58 ` [PATCH v4 01/14] drm/bridge: analogix_dp: Return bitmask from analogix_dp_get_irq_type() Damon Ding
2026-10-19  8:58   ` Damon Ding
2026-10-19  8:58 ` [PATCH v4 02/14] drm/bridge: analogix_dp: Check all negative return values for &analogix_dp_device.irq Damon Ding
2026-10-19  8:58   ` Damon Ding
2026-10-19  9:04   ` sashiko-bot [this message]
2026-10-19  8:58 ` [PATCH v4 03/14] drm/bridge: analogix_dp: Add IRQF_ONESHOT and simplify IRQ handling Damon Ding
2026-10-19  8:58   ` Damon Ding
2026-10-19  8:58 ` [PATCH v4 04/14] drm/bridge: analogix_dp: Extend clear_hotplug_interrupts to accept IRQ bitmask Damon Ding
2026-10-19  8:58   ` Damon Ding
2026-10-19  8:58 ` [PATCH v4 05/14] drm/bridge: analogix_dp: Extend mute/unmute HPD interrupts to accept irq bitmask Damon Ding
2026-10-19  8:58   ` Damon Ding
2026-10-19  8:58 ` [PATCH v4 06/14] drm/bridge: analogix_dp: Simplify analogix_dp_config_interrupt() Damon Ding
2026-10-19  8:58   ` Damon Ding
2026-10-19  8:58 ` [PATCH v4 07/14] drm/bridge: analogix_dp: Use platform-specific HPD detection scheme Damon Ding
2026-10-19  8:58   ` Damon Ding
2026-10-19  8:58 ` [PATCH v4 08/14] drm/bridge: analogix_dp: Skip native HPD interrupt ops for GPIO HPD Damon Ding
2026-10-19  8:58   ` Damon Ding
2026-10-19  8:58 ` [PATCH v4 09/14] drm/bridge: analogix_dp: Move IRQ enable/disable to bind/unbind Damon Ding
2026-10-19  8:58   ` Damon Ding
2026-10-19  9:17   ` sashiko-bot
2026-10-19  8:58 ` [PATCH v4 10/14] drm/bridge: analogix_dp: Manage pm runtime and IRQ for native HPD pin detection Damon Ding
2026-10-19  8:58   ` Damon Ding
2026-10-19  9:28   ` sashiko-bot
2026-10-19  8:58 ` [PATCH v4 11/14] drm/bridge: analogix_dp: Use bridge->next_bridge instead of plat_data field Damon Ding
2026-10-19  8:58   ` Damon Ding
2026-10-19  9:12   ` sashiko-bot
2026-10-20  5:36   ` kernel test robot
2026-10-20  5:36     ` kernel test robot
2026-10-20 10:38     ` Heiko Stübner
2026-10-20 10:38       ` Heiko Stübner
2026-10-20 11:42       ` Damon Ding
2026-10-20 11:42         ` Damon Ding
2026-10-20  5:37   ` kernel test robot
2026-10-20  5:37     ` kernel test robot
2026-10-19  8:58 ` [PATCH v4 12/14] drm/bridge: analogix_dp: Restrict forced connected status to panel endpoints Damon Ding
2026-10-19  8:58   ` Damon Ding
2026-10-19  9:25   ` sashiko-bot
2026-10-19  8:58 ` [PATCH v4 13/14] drm/bridge: analogix_dp: Handle HPD notification from downstream bridge Damon Ding
2026-10-19  8:58   ` Damon Ding
2026-10-19  9:16   ` sashiko-bot
2026-10-19  8:58 ` [PATCH v4 14/14] MAINTAINERS: Add entry for Analogix DP controller bridge Damon Ding
2026-10-19  8:58   ` Damon Ding

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-176864@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=damon.ding@rock-chips.com \
    --cc=dri-devel@lists.freedesktop.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.