DMA Engine development
 help / color / mirror / Atom feed
* [bug report] dmaengine: ls2x-apb: New driver for the Loongson LS2X APB DMA controller
@ 2024-10-25  8:59 Dan Carpenter
  2024-10-28  2:40 ` Binbin Zhou
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2024-10-25  8:59 UTC (permalink / raw)
  To: Binbin Zhou; +Cc: dmaengine

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()?

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

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] dmaengine: ls2x-apb: New driver for the Loongson LS2X APB DMA controller
  2024-10-25  8:59 [bug report] dmaengine: ls2x-apb: New driver for the Loongson LS2X APB DMA controller Dan Carpenter
@ 2024-10-28  2:40 ` Binbin Zhou
  0 siblings, 0 replies; 2+ messages in thread
From: Binbin Zhou @ 2024-10-28  2:40 UTC (permalink / raw)
  To: Dan Carpenter, Huacai Chen, Huacai Chen, zhoubb.aaron; +Cc: dmaengine

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-28  2:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-25  8:59 [bug report] dmaengine: ls2x-apb: New driver for the Loongson LS2X APB DMA controller Dan Carpenter
2024-10-28  2:40 ` Binbin Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox