Re: [PATCH] dmaengine: loongson: loongson2-apb-cmc: Fix signedness bug in irq handling
Huacai Chen <[email protected]>
| Newsgroups | org.kernel.vger.dmaengine |
|---|---|
| Message-ID | <CAAhV-H73pU-2mguZNMyM1vjA75BOA86jFcER=FVy=m+oJ6jkPQ@mail.gmail.com> |
Reviewed-by: Huacai Chen <[email protected]> On Tue, Aug 18, 2026 at 5:35 PM Binbin Zhou <[email protected]> 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]> > --- > 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 >