Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: aha1542: Remove unneeded scsi_dma_unmap() call
@ 2026-09-29 14:45 Matthew Whitehead
  2026-10-07 17:08 ` Laurence Oberman
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Whitehead @ 2026-09-29 14:45 UTC (permalink / raw)
  To: linux-scsi; +Cc: tedheadster, mkp, James.Bottomley, loberman, emilne

aha1542 never DMA maps the command's scatterlist. Data is bounced
through a per-command buffer allocated with dma_alloc_coherent() in
aha1542_init_cmd_priv(), the adapter is programmed with
acmd->data_buffer_handle, and the payload is copied to and from the
request segments in aha1542_queuecommand() and aha1542_free_cmd().

The scsi_dma_unmap() call left in aha1542_free_cmd() therefore unmaps
a scatterlist that was never mapped. With CONFIG_DMA_API_DEBUG enabled
this results in:

  device driver tries to free DMA memory it has not allocated
    [device address=0x0000000000000000] [size=0 bytes]

Remove the call.

Verified by testing on real hardware.

Fixes: 2f2fef022c3e ("aha1542: use a local bounce buffer")
Suggested-by: Laurence Oberman <loberman@redhat.com>
Assisted-by: LLM
Signed-off-by: Matthew Whitehead <tedheadster@gmail.com>
---
 drivers/scsi/aha1542.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index fd766282d4a4..a197b3d0b26b 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -271,8 +271,6 @@ static void aha1542_free_cmd(struct scsi_cmnd *cmd)
 			buf += bv.bv_len;
 		}
 	}
-
-	scsi_dma_unmap(cmd);
 }
 
 static irqreturn_t aha1542_interrupt(int irq, void *dev_id)
-- 
2.52.0


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

* Re: [PATCH] scsi: aha1542: Remove unneeded scsi_dma_unmap() call
  2026-09-29 14:45 [PATCH] scsi: aha1542: Remove unneeded scsi_dma_unmap() call Matthew Whitehead
@ 2026-10-07 17:08 ` Laurence Oberman
  0 siblings, 0 replies; 2+ messages in thread
From: Laurence Oberman @ 2026-10-07 17:08 UTC (permalink / raw)
  To: Matthew Whitehead, linux-scsi; +Cc: mkp, James.Bottomley, emilne

On Tue, 2026-09-29 at 10:45 -0400, Matthew Whitehead wrote:
> aha1542 never DMA maps the command's scatterlist. Data is bounced
> through a per-command buffer allocated with dma_alloc_coherent() in
> aha1542_init_cmd_priv(), the adapter is programmed with
> acmd->data_buffer_handle, and the payload is copied to and from the
> request segments in aha1542_queuecommand() and aha1542_free_cmd().
> 
> The scsi_dma_unmap() call left in aha1542_free_cmd() therefore unmaps
> a scatterlist that was never mapped. With CONFIG_DMA_API_DEBUG
> enabled
> this results in:
> 
>   device driver tries to free DMA memory it has not allocated
>     [device address=0x0000000000000000] [size=0 bytes]
> 
> Remove the call.
> 
> Verified by testing on real hardware.
> 
> Fixes: 2f2fef022c3e ("aha1542: use a local bounce buffer")
> Suggested-by: Laurence Oberman <loberman@redhat.com>
> Assisted-by: LLM
> Signed-off-by: Matthew Whitehead <tedheadster@gmail.com>
> ---
>  drivers/scsi/aha1542.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
> index fd766282d4a4..a197b3d0b26b 100644
> --- a/drivers/scsi/aha1542.c
> +++ b/drivers/scsi/aha1542.c
> @@ -271,8 +271,6 @@ static void aha1542_free_cmd(struct scsi_cmnd
> *cmd)
>  			buf += bv.bv_len;
>  		}
>  	}
> -
> -	scsi_dma_unmap(cmd);
>  }
>  
>  static irqreturn_t aha1542_interrupt(int irq, void *dev_id)

Looks correct to me, and was tested at Red Hat.

Reviewed-by: Laurence Oberman <loberman@redhat.com>


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

end of thread, other threads:[~2026-10-07 17:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-29 14:45 [PATCH] scsi: aha1542: Remove unneeded scsi_dma_unmap() call Matthew Whitehead
2026-10-07 17:08 ` Laurence Oberman

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