Skip to contentSkip to conversation

rbd: null vs ERR_PTR

PATCH New Dan Carpenter 1 participant 1 message Oct 11, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 rbd: null vs ERR_PTR

ceph_alloc_page_vector() returns ERR_PTR(-ENOMEM) on errors.

drivers/block/rbd.c +2 -2
index 1ac87f1..52f9420 100644
@@ -826,8 +826,8 @@ static int rbd_req_sync_op(struct rbd_device *dev,
 
 	num_pages = calc_pages_for(ofs , len);
 	pages = ceph_alloc_page_vector(num_pages, GFP_KERNEL);
-	if (!pages)
-		return -ENOMEM;
+	if (IS_ERR(pages))
+		return PTR_ERR(pages);
 
 	if (!orig_ops) {
 		payload_len = (flags & CEPH_OSD_FLAG_WRITE ? len : 0);