diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index d29171629b0ff1be5174768ff32f2efd81ba78b8..39186bfd9bb9f5010a3cd3844b3854e1104db4bc 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -709,7 +709,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
 		/* In case sync failed due to ENOSPC the inode was actually
 		 * written (only some dirty data were not) so we just proceed
 		 * as if nothing happened and cleanup the unused block */
-		if (error && error != ENOSPC) {
+		if (error && error != -ENOSPC) {
 			if (new_bh && new_bh != old_bh)
 				DQUOT_FREE_BLOCK(inode, 1);
 			goto cleanup;