Re: [bug report] dmaengine: ls2x-apb: New driver for the Loongson LS2X APB DMA controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan:

Thanks for your report.

On 2024/10/25 16:59, Dan Carpenter wrote:
Hello Binbin Zhou,

Commit 71e7d3cb6e55 ("dmaengine: ls2x-apb: New driver for the
Loongson LS2X APB DMA controller") from Dec 18, 2023 (linux-next),
leads to the following Smatch static checker warning:

	drivers/dma/loongson2-apb-dma.c:189 ls2x_dma_write_cmd()
	warn: was expecting a 64 bit value instead of '~(((0)) + (((~((0))) - (((1)) << (0)) + 1) & (~((0)) >> ((8 * 4) - 1 - (4)))))'

drivers/dma/loongson2-apb-dma.c
     184 static void ls2x_dma_write_cmd(struct ls2x_dma_chan *lchan, bool cmd)
     185 {
     186         struct ls2x_dma_priv *priv = to_ldma_priv(lchan->vchan.chan.device);
     187         u64 val;
     188
--> 189         val = lo_hi_readq(priv->regs + LDMA_ORDER_ERG) & ~LDMA_CONFIG_MASK;

On a 32bit build the ~LDMA_CONFIG_MASK will zero out the high 32 bits.  Should
LDMA_CONFIG_MASK be defined with GENMASK_ULL()?
Indeed, it is more appropriate to define it as GENMASK_ULL().

I'll submit a patch to redefine it.


Thanks.

Binbin


     190         val |= LDMA_64BIT_EN | cmd;
     191         lo_hi_writeq(val, priv->regs + LDMA_ORDER_ERG);
     192 }

regards,
dan carpenter





[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux