mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	btrfs: add missing error return to btrfs_clear_extent_bit_changeset()
We have a couple error branches where we have an error stored in the 'err' variable and then jump to the 'out' label, however we don't return that error, we just return 0. Normally this is not a problem since those error branches call extent_io_tree_panic() which triggers a BUG() call, however it's possible to have rather exotic kernel config with CONFIG_BUG disabled in which case the BUG() call does nothing and we fallthrough. So make sure to return the error, not just to fix that exotic case but also to make the code less confusing. While at it also rename the 'err' variable to 'ret' since this is the style we prefer and use more widely. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
		
							parent
							
								
									2187540b6f
								
							
						
					
					
						commit
						5af1eae78d
					
				
					 1 changed files with 8 additions and 8 deletions
				
			
		|  | @ -604,7 +604,7 @@ int btrfs_clear_extent_bit_changeset(struct extent_io_tree *tree, u64 start, u64 | |||
| 	struct extent_state *cached; | ||||
| 	struct extent_state *prealloc = NULL; | ||||
| 	u64 last_end; | ||||
| 	int err; | ||||
| 	int ret = 0; | ||||
| 	int clear = 0; | ||||
| 	int wake; | ||||
| 	int delete = (bits & EXTENT_CLEAR_ALL_BITS); | ||||
|  | @ -690,10 +690,10 @@ int btrfs_clear_extent_bit_changeset(struct extent_io_tree *tree, u64 start, u64 | |||
| 		prealloc = alloc_extent_state_atomic(prealloc); | ||||
| 		if (!prealloc) | ||||
| 			goto search_again; | ||||
| 		err = split_state(tree, state, prealloc, start); | ||||
| 		ret = split_state(tree, state, prealloc, start); | ||||
| 		prealloc = NULL; | ||||
| 		if (err) { | ||||
| 			extent_io_tree_panic(tree, state, "split", err); | ||||
| 		if (ret) { | ||||
| 			extent_io_tree_panic(tree, state, "split", ret); | ||||
| 			goto out; | ||||
| 		} | ||||
| 		if (state->end <= end) { | ||||
|  | @ -711,9 +711,9 @@ int btrfs_clear_extent_bit_changeset(struct extent_io_tree *tree, u64 start, u64 | |||
| 		prealloc = alloc_extent_state_atomic(prealloc); | ||||
| 		if (!prealloc) | ||||
| 			goto search_again; | ||||
| 		err = split_state(tree, state, prealloc, end + 1); | ||||
| 		if (err) { | ||||
| 			extent_io_tree_panic(tree, state, "split", err); | ||||
| 		ret = split_state(tree, state, prealloc, end + 1); | ||||
| 		if (ret) { | ||||
| 			extent_io_tree_panic(tree, state, "split", ret); | ||||
| 			prealloc = NULL; | ||||
| 			goto out; | ||||
| 		} | ||||
|  | @ -748,7 +748,7 @@ int btrfs_clear_extent_bit_changeset(struct extent_io_tree *tree, u64 start, u64 | |||
| 	if (prealloc) | ||||
| 		btrfs_free_extent_state(prealloc); | ||||
| 
 | ||||
| 	return 0; | ||||
| 	return ret; | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Filipe Manana
						Filipe Manana