Skip to contentSkip to conversation

md/bitmap:Don't use IS_ERR to judge alloc_page().

PATCH Applied Jianpeng Ma 2 participants 2 messages Sep 15, 2012 – Sep 20, 2012 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 md/bitmap:Don't use IS_ERR to judge alloc_page().

---
 drivers/md/bitmap.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/md/bitmap.c +2 -5
index 94e7f6b..f03ad11 100644
@@ -476,11 +476,8 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap)
 	int err = -EINVAL;
 
 	bitmap->storage.sb_page = alloc_page(GFP_KERNEL);
-	if (IS_ERR(bitmap->storage.sb_page)) {
-		err = PTR_ERR(bitmap->storage.sb_page);
-		bitmap->storage.sb_page = NULL;
-		return err;
-	}
+	if (bitmap->storage.sb_page == NULL)
+		return -ENOMEM;
 	bitmap->storage.sb_page->index = 0;
 
 	sb = kmap_atomic(bitmap->storage.sb_page);
Signature · 1 line
1.7.9.5
Applied
#1 lore raw
Quoted 13 lines · On Sat, 15 Sep 2012 10:43:00 +0800 "Jianpeng Ma" <[email protected]> wrote:
---
 drivers/md/bitmap.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/md/bitmap.c +0 -0
index 94e7f6b..f03ad11 100644
@@ -476,11 +476,8 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap)
 	int err = -EINVAL;
 
 	bitmap->storage.sb_page = alloc_page(GFP_KERNEL);

drivers/md/bitmap.c static int bitmap_new_disk_sb(struct bitmap *bitmap) · line 483

Quoted 10 lines
drivers/md/bitmap.c +2 -5
-	if (IS_ERR(bitmap->storage.sb_page)) {
-		err = PTR_ERR(bitmap->storage.sb_page);
-		bitmap->storage.sb_page = NULL;
-		return err;
-	}
+	if (bitmap->storage.sb_page == NULL)
+		return -ENOMEM;
 	bitmap->storage.sb_page->index = 0;
 
 	sb = kmap_atomic(bitmap->storage.sb_page);

Applied,
Thanks,
NeilBrown