Commit f712e24c authored by Michael Schmitz's avatar Michael Schmitz Committed by Martin K. Petersen
Browse files

scsi: gvp11.c: Fix DMA mask calculation error

DMA masks given in the Zorro ID table don't contain the 2 byte alignment
quirk seen in the GVP11_XFER_MASK macro from gvp11.h so no need to account
for that.

DMA masks passed to dma_set_mask_and_coherent() must be 64 bit, add the
missing cast in the TO_DMA_MASK macro used to convert driver DMA masks to
DMA API masks.

Link: https://lore.kernel.org/r/6d1d88ee-1cf6-c735-1e6d-bafd2096e322@gmail.com
Link: https://lore.kernel.org/r/20220713074913.7873-1-schmitzmic@gmail.com


Fixes: 158da6bc ("scsi: gvp11: Convert m68k WD33C93 drivers to DMA API")
CC: linux-scsi@vger.kernel.org
Signed-off-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent c641ffdb
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ struct gvp11_hostdata {
};

#define DMA_DIR(d)   ((d == DATA_OUT_DIR) ? DMA_TO_DEVICE : DMA_FROM_DEVICE)
#define TO_DMA_MASK(m)	((~(m & 0xfffffff0))-1)
#define TO_DMA_MASK(m)	(~((unsigned long long)m & 0xffffffff))

static irqreturn_t gvp11_intr(int irq, void *data)
{
@@ -334,7 +334,7 @@ static int gvp11_probe(struct zorro_dev *z, const struct zorro_device_id *ent)

	if (dma_set_mask_and_coherent(&z->dev,
		TO_DMA_MASK(default_dma_xfer_mask))) {
		dev_warn(&z->dev, "cannot use DMA mask %x\n",
		dev_warn(&z->dev, "cannot use DMA mask %llx\n",
			 TO_DMA_MASK(default_dma_xfer_mask));
		return -ENODEV;
	}
@@ -383,7 +383,7 @@ static int gvp11_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
		hdata->wh.dma_xfer_mask = gvp11_xfer_mask;
		if (dma_set_mask_and_coherent(&z->dev,
			TO_DMA_MASK(gvp11_xfer_mask))) {
			dev_warn(&z->dev, "cannot use DMA mask %x\n",
			dev_warn(&z->dev, "cannot use DMA mask %llx\n",
				 TO_DMA_MASK(gvp11_xfer_mask));
			error = -ENODEV;
			goto fail_check_or_alloc;