Skip to contentSkip to conversation

fs:btrfs: return -ENOMEM on allocation failure.

PATCH In review Allen Pais 2 participants 2 messages Sep 20, 2017 Btrfs file system

lore
Share & tools
lore

Allen Pais

author
#0 lore raw

PATCH v2 1/1 fs:btrfs: return -ENOMEM on allocation failure.

v2: return -ENOMEM from btrfsic_dev_state_alloc() too.

---
 fs/btrfs/check-integrity.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/check-integrity.c +2 -2
index 7d5a9b5..9db1e76 100644
@@ -2913,7 +2913,7 @@ int btrfsic_mount(struct btrfs_fs_info *fs_info,
 	state = kvzalloc(sizeof(*state), GFP_KERNEL);
 	if (!state) {
 		pr_info("btrfs check-integrity: allocation failed!\n");
-		return -1;
+		return -ENOMEM;
 	}
 
 	if (!btrfsic_is_initialized) {
@@ -2945,7 +2945,7 @@ int btrfsic_mount(struct btrfs_fs_info *fs_info,
 		if (NULL == ds) {
 			pr_info("btrfs check-integrity: kmalloc() failed!\n");
 			mutex_unlock(&btrfsic_mutex);
-			return -1;
+			return -ENOMEM;
 		}
 		ds->bdev = device->bdev;
 		ds->state = state;
Signature · 1 line
2.7.4
Reviewed-by on v2 1/1
#1 lore raw
Quoted 3 lines · Allen Pais

v2: return -ENOMEM from btrfsic_dev_state_alloc() too.

Quoted 27 lines
---
  fs/btrfs/check-integrity.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/check-integrity.c +2 -2
index 7d5a9b5..9db1e76 100644
@@ -2913,7 +2913,7 @@ int btrfsic_mount(struct btrfs_fs_info *fs_info,
  	state = kvzalloc(sizeof(*state), GFP_KERNEL);
  	if (!state) {
  		pr_info("btrfs check-integrity: allocation failed!\n");
-		return -1;
+		return -ENOMEM;
  	}
 
  	if (!btrfsic_is_initialized) {
@@ -2945,7 +2945,7 @@ int btrfsic_mount(struct btrfs_fs_info *fs_info,
  		if (NULL == ds) {
  			pr_info("btrfs check-integrity: kmalloc() failed!\n");
  			mutex_unlock(&btrfsic_mutex);
-			return -1;
+			return -ENOMEM;
  		}
  		ds->bdev = device->bdev;
  		ds->state = state;