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 <[email protected]>

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/[email protected]/

> 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/[email protected]?part=2

Reply via email to