[Cbe-oss-dev] [PATCH 3/9] Flatten the for loop in spufs_arch_notes_size()

Michael Ellerman michael at ellerman.id.au
Fri Aug 17 17:19:10 EST 2007


Signed-off-by: Michael Ellerman <michael at ellerman.id.au>
---
 arch/powerpc/platforms/cell/spufs/coredump.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index 520aa24..741d05f 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -134,19 +134,23 @@ static int spufs_add_one_context(struct file *file, int dfd)
 static int spufs_arch_notes_size(void)
 {
 	struct fdtable *fdt = files_fdtable(current->files);
-	int size = 0, fd;
+	struct file *file;
+	int size = 0, rc, fd;
 
 	for (fd = 0; fd < fdt->max_fds; fd++) {
-		if (FD_ISSET(fd, fdt->open_fds)) {
-			struct file *file = fcheck(fd);
-
-			if (file && file->f_op == &spufs_context_fops) {
-				int rval = spufs_add_one_context(file, fd);
-				if (rval < 0)
-					break;
-				size += rval;
-			}
-		}
+		if (!FD_ISSET(fd, fdt->open_fds))
+			continue;
+
+		file = fcheck(fd);
+
+		if (!file || file->f_op != &spufs_context_fops)
+			continue;
+
+		rc = spufs_add_one_context(file, fd);
+		if (rc < 0)
+			break;
+
+		size += rc;
 	}
 
 	return size;
-- 
1.5.1.3.g7a33b




More information about the cbe-oss-dev mailing list