diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index 5f383e605b..f5c35f24ad 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -1067,6 +1067,7 @@ ztest_pattern_set(void *buf, uint64_t size, uint64_t value)
 		*ip++ = value;
 }
 
+#ifndef NDEBUG
 static boolean_t
 ztest_pattern_match(void *buf, uint64_t size, uint64_t value)
 {
@@ -1079,6 +1080,7 @@ ztest_pattern_match(void *buf, uint64_t size, uint64_t value)
 
 	return (diff == 0);
 }
+#endif
 
 static void
 ztest_bt_generate(ztest_block_tag_t *bt, objset_t *os, uint64_t object,
diff --git a/module/zfs/vdev_file.c b/module/zfs/vdev_file.c
index 8c22aa5316..f31389a6df 100644
--- a/module/zfs/vdev_file.c
+++ b/module/zfs/vdev_file.c
@@ -143,7 +143,7 @@ vdev_file_io_start(zio_t *zio)
 {
 	vdev_t *vd = zio->io_vd;
 	vdev_file_t *vf = vd->vdev_tsd;
-	ssize_t resid;
+	ssize_t resid = 0;
 
 	if (zio->io_type == ZIO_TYPE_IOCTL) {
 		/* XXPOLICY */