Module Name:    src
Committed By:   andvar
Date:           Sun Dec 17 22:01:56 UTC 2023

Modified Files:
        src/sys/arch/x68k/dev: intio_dmac.c

Log Message:
Fix DMAC_ARRAYCHAIN enabled build:
pass dmac->sc_dev instead of undefined self in dmac_start_xfer_offset().
remove unused chan/ch variables in dmac_program_arraychain().
initialize c to zero in dmac_start_xfer_offset() and add check that is bigger
than 0 before calling dma_cachectl() to fix potentially uninitialized error
(seems to be false positive though).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/x68k/dev/intio_dmac.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x68k/dev/intio_dmac.c
diff -u src/sys/arch/x68k/dev/intio_dmac.c:1.37 src/sys/arch/x68k/dev/intio_dmac.c:1.38
--- src/sys/arch/x68k/dev/intio_dmac.c:1.37	Fri Aug 11 07:30:01 2017
+++ src/sys/arch/x68k/dev/intio_dmac.c	Sun Dec 17 22:01:56 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: intio_dmac.c,v 1.37 2017/08/11 07:30:01 isaki Exp $	*/
+/*	$NetBSD: intio_dmac.c,v 1.38 2023/12/17 22:01:56 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_m68k_arch.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intio_dmac.c,v 1.37 2017/08/11 07:30:01 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intio_dmac.c,v 1.38 2023/12/17 22:01:56 andvar Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -352,7 +352,7 @@ dmac_start_xfer_offset(struct dmac_softc
 	bus_addr_t paddr;
 	uint8_t csr;
 #ifdef DMAC_ARRAYCHAIN
-	int c;
+	int c = 0;
 #endif
 
 	DPRINTF(3, ("dmac_start_xfer\n"));
@@ -411,7 +411,7 @@ dmac_start_xfer_offset(struct dmac_softc
 #endif
 	} else {
 #ifdef DMAC_ARRAYCHAIN
-		c = dmac_program_arraychain(self, xf, offset, size);
+		c = dmac_program_arraychain(dmac->sc_dev, xf, offset, size);
 		bus_space_write_4(dmac->sc_bst, chan->ch_bht,
 				  DMAC_REG_BAR, (int) chan->ch_seg[0].ds_addr);
 		bus_space_write_2(dmac->sc_bst, chan->ch_bht,
@@ -429,7 +429,7 @@ dmac_start_xfer_offset(struct dmac_softc
 #ifdef DMAC_ARRAYCHAIN
 #if defined(M68040) || defined(M68060)
 	/* flush data cache for the map */
-	if (dmamap->dm_nsegs != 1 && mmutype == MMU_68040)
+	if (dmamap->dm_nsegs != 1i && mmutype == MMU_68040 && c > 0)
 		dma_cachectl((void *) xf->dx_array,
 			     sizeof(struct dmac_sg_array) * c);
 #endif
@@ -444,8 +444,6 @@ static int
 dmac_program_arraychain(device_t self, struct dmac_dma_xfer *xf,
     u_int offset, u_int size)
 {
-	struct dmac_channel_stat *chan = xf->dx_channel;
-	int ch = chan->ch_channel;
 	struct x68k_bus_dmamap *map = xf->dx_dmamap;
 	int i, j;
 

Reply via email to