]> err.no Git - linux-2.6/blobdiff - arch/powerpc/platforms/cell/spufs/coredump.c
[POWERPC] spufs: fix incorrect file descriptors in SPU coredump note names
[linux-2.6] / arch / powerpc / platforms / cell / spufs / coredump.c
index 80f62363e1ce1708c19662fa003bebc9b5459a72..b962c3ab470cbe01f2f5a5d6e510866bd8a60e5a 100644 (file)
@@ -133,8 +133,6 @@ static struct spu_context *coredump_next_context(int *fd)
                if (ctx->flags & SPU_CREATE_NOSCHED)
                        continue;
 
-               /* start searching the next fd next time we're called */
-               (*fd)++;
                break;
        }
 
@@ -148,13 +146,18 @@ int spufs_coredump_extra_notes_size(void)
 
        fd = 0;
        while ((ctx = coredump_next_context(&fd)) != NULL) {
-               spu_acquire_saved(ctx);
+               rc = spu_acquire_saved(ctx);
+               if (rc)
+                       break;
                rc = spufs_ctx_note_size(ctx, fd);
                spu_release_saved(ctx);
                if (rc < 0)
                        break;
 
                size += rc;
+
+               /* start searching the next fd next time */
+               fd++;
        }
 
        return size;
@@ -224,7 +227,9 @@ int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset)
 
        fd = 0;
        while ((ctx = coredump_next_context(&fd)) != NULL) {
-               spu_acquire_saved(ctx);
+               rc = spu_acquire_saved(ctx);
+               if (rc)
+                       return rc;
 
                for (j = 0; spufs_coredump_read[j].name != NULL; j++) {
                        rc = spufs_arch_write_note(ctx, j, file, fd, foffset);
@@ -235,6 +240,9 @@ int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset)
                }
 
                spu_release_saved(ctx);
+
+               /* start searching the next fd next time */
+               fd++;
        }
 
        return 0;