[PATCH] misc: genwqe: Fixes DMA mask setting

From: Christophe JAILLET
Date: Wed Sep 08 2021 - 15:56:16 EST


Commit 505b08777d78 ("misc: genwqe: Use dma_set_mask_and_coherent to simplify code")
changed the logic in the code.

Instead of a ||, a && should have been used to keep the code the same.

Fixes: 505b08777d78 ("misc: genwqe: Use dma_set_mask_and_coherent to simplify code")
Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
Also as reported in [1], setting a 64 bits DMA mask never fails if
dev->dma_mask is non-NULL.
So the code could be simplified further.

Even if told twice that it is safe, and checking the code in the different
platforms, I'm still unsure about it :(

So I first post the fix to the bug I've introduced (sorry about that).
Should it be confirmed another time that removing the 32-bits case is safe,
then I'll send a v2 which does the additional clean-up.
---
drivers/misc/genwqe/card_base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/genwqe/card_base.c b/drivers/misc/genwqe/card_base.c
index 2e1befbd1ad9..693981891870 100644
--- a/drivers/misc/genwqe/card_base.c
+++ b/drivers/misc/genwqe/card_base.c
@@ -1090,7 +1090,7 @@ static int genwqe_pci_setup(struct genwqe_dev *cd)

/* check for 64-bit DMA address supported (DAC) */
/* check for 32-bit DMA address supported (SAC) */
- if (dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)) ||
+ if (dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)) &&
dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32))) {
dev_err(&pci_dev->dev,
"err: neither DMA32 nor DMA64 supported\n");
--
2.30.2