vfs: do_last(): clean up error handling
authorMiklos Szeredi <mszeredi@suse.cz>
Tue, 5 Jun 2012 13:10:28 +0000 (15:10 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 14 Jul 2012 12:33:20 +0000 (16:33 +0400)
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c

index 0ed876259f8b62fba647e5044551750a00c299b1..044215a7bb0c20bbe61e9ae7062fde3b1ec7f592 100644 (file)
@@ -2634,21 +2634,14 @@ common:
        if (error)
                goto exit_fput;
 opened:
-       if (!IS_ERR(filp)) {
-               error = ima_file_check(filp, op->acc_mode);
-               if (error) {
-                       fput(filp);
-                       filp = ERR_PTR(error);
-               }
-       }
-       if (!IS_ERR(filp)) {
-               if (will_truncate) {
-                       error = handle_truncate(filp);
-                       if (error) {
-                               fput(filp);
-                               filp = ERR_PTR(error);
-                       }
-               }
+       error = ima_file_check(filp, op->acc_mode);
+       if (error)
+               goto exit_fput;
+
+       if (will_truncate) {
+               error = handle_truncate(filp);
+               if (error)
+                       goto exit_fput;
        }
 out:
        if (want_write)