Re: [PATCH] dmaengine: loongson: loongson2-apb-cmc: Fix signedness bug in irq handling
Frank Li <[email protected]>
| Newsgroups | org.kernel.vger.dmaengine |
|---|---|
| Message-ID | <aoSKufd0kvtx0LQH@SMW015318> |
On Tue, Aug 18, 2026 at 05:34:48PM +0800, Binbin Zhou wrote:
> Storing that negative value into an unsigned variable makes the check
> `if (lchan->irq < 0)` always false, so probe errors are not correctly
> detected and propagated.
>
> Fix this by changing the type of `irq` to `int`, which allows proper
> signed comparison and error handling.
>
> Fixes: 1c0028e725f1 ("dmaengine: loongson: New driver for the Loongson Multi-Channel DMA controller")
> Reported-by: Julia Lawall <[email protected]>
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/r/[email protected]/
> Signed-off-by: Binbin Zhou <[email protected]>
> ---
Reviewed-by: Frank Li <[email protected]>
> drivers/dma/loongson/loongson2-apb-cmc-dma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/loongson/loongson2-apb-cmc-dma.c b/drivers/dma/loongson/loongson2-apb-cmc-dma.c
> index 1c9a542edc85..969dbc5dabe7 100644
> --- a/drivers/dma/loongson/loongson2-apb-cmc-dma.c
> +++ b/drivers/dma/loongson/loongson2-apb-cmc-dma.c
> @@ -90,7 +90,7 @@ struct loongson2_cmc_dma_chan {
> struct dma_slave_config dma_sconfig;
> struct loongson2_cmc_dma_desc *desc;
> u32 id;
> - u32 irq;
> + int irq;
> u32 next_sg;
> struct loongson2_cmc_dma_chan_reg chan_reg;
> };
>
> base-commit: 075b74841bd0065a3bda3440873c747938e69b68
> --
> 2.52.0
>