convert_initialized_extent(handle_t *handle, struct inode *inode,
                           struct ext4_map_blocks *map,
                           struct ext4_ext_path **ppath,
-                          unsigned int allocated)
+                          unsigned int *allocated)
 {
        struct ext4_ext_path *path = *ppath;
        struct ext4_extent *ex;
        ext4_update_inode_fsync_trans(handle, inode, 1);
 
        map->m_flags |= EXT4_MAP_UNWRITTEN;
-       if (allocated > map->m_len)
-               allocated = map->m_len;
-       map->m_len = allocated;
-       return allocated;
+       if (*allocated > map->m_len)
+               *allocated = map->m_len;
+       map->m_len = *allocated;
+       return 0;
 }
 
 static int
                         */
                        if ((!ext4_ext_is_unwritten(ex)) &&
                            (flags & EXT4_GET_BLOCKS_CONVERT_UNWRITTEN)) {
-                               allocated = convert_initialized_extent(
-                                               handle, inode, map, &path,
-                                               allocated);
+                               err = convert_initialized_extent(handle,
+                                       inode, map, &path, &allocated);
                                goto out2;
-                       } else if (!ext4_ext_is_unwritten(ex))
+                       } else if (!ext4_ext_is_unwritten(ex)) {
                                goto out;
+                       }
 
                        ret = ext4_ext_handle_unwritten_extents(
                                handle, inode, map, &path, flags,