Module Name: src
Committed By: riastradh
Date: Fri Dec 24 15:08:31 UTC 2021
Modified Files:
src/sys/external/bsd/drm2/linux: linux_sgt.c
Log Message:
drm: Sprinkle some assertions into sg dma logic.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/linux/linux_sgt.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/external/bsd/drm2/linux/linux_sgt.c
diff -u src/sys/external/bsd/drm2/linux/linux_sgt.c:1.3 src/sys/external/bsd/drm2/linux/linux_sgt.c:1.4
--- src/sys/external/bsd/drm2/linux/linux_sgt.c:1.3 Sun Dec 19 12:10:42 2021
+++ src/sys/external/bsd/drm2/linux/linux_sgt.c Fri Dec 24 15:08:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_sgt.c,v 1.3 2021/12/19 12:10:42 riastradh Exp $ */
+/* $NetBSD: linux_sgt.c,v 1.4 2021/12/24 15:08:31 riastradh Exp $ */
/*-
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_sgt.c,v 1.3 2021/12/19 12:10:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sgt.c,v 1.4 2021/12/24 15:08:31 riastradh Exp $");
#include <sys/bus.h>
#include <sys/errno.h>
@@ -153,6 +153,7 @@ dma_map_sg_attrs(bus_dma_tag_t dmat, str
int ret, error = 0;
KASSERT(sg->sg_dmamap == NULL);
+ KASSERT(sg->sg_npgs);
KASSERT(nents >= 1);
switch (dir) {
@@ -213,6 +214,8 @@ dma_unmap_sg_attrs(bus_dma_tag_t dmat, s
int dir, int attrs)
{
+ KASSERT(sg->sg_dmat == dmat);
+
bus_dmamap_unload(dmat, sg->sg_dmamap);
bus_dmamap_destroy(dmat, sg->sg_dmamap);
sg->sg_dmamap = NULL;