From f505490c8d48dc415bb64dc86e8be8ff4bed2c52 Mon Sep 17 00:00:00 2001 From: pooka Date: Sun, 5 Apr 2009 15:10:41 +0000 Subject: Invariants should be tested for with KASSERT instead of semi-pretending that them not holding is an acceptable error condition. --- sys/fs/tmpfs/tmpfs_vnops.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'sys') diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 0167d0eb0be..362f228c963 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: tmpfs_vnops.c,v 1.55 2009/04/03 14:47:40 pooka Exp $ */ +/* $NetBSD: tmpfs_vnops.c,v 1.56 2009/04/05 15:10:41 pooka Exp $ */ /* * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.55 2009/04/03 14:47:40 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.56 2009/04/05 15:10:41 pooka Exp $"); #include #include @@ -652,10 +652,7 @@ tmpfs_remove(void *v) node = VP_TO_TMPFS_NODE(vp); tmp = VFS_TO_TMPFS(vp->v_mount); de = tmpfs_dir_lookup(dnode, cnp); - if (de == NULL) { - error = ENOENT; - goto out; - } + KASSERT(de); KASSERT(de->td_node == node); /* Files marked as immutable or append-only cannot be deleted. */ @@ -1031,10 +1028,7 @@ tmpfs_rmdir(void *v) /* Get the directory entry associated with node (vp). */ de = tmpfs_dir_lookup(dnode, cnp); - if (de == NULL) { - error = ENOENT; - goto out; - } + KASSERT(de); KASSERT(de->td_node == node); /* Check flags to see if we are allowed to remove the directory. */ -- cgit