Skip to contentSkip to conversation

md/dm-log: use PTR_ERR value instead of -ENOMEM

PATCH In review Dan Carpenter 2 participants 2 messages May 16, 2010 – Jan 7, 2011

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

PATCH 1/1 md/dm-log: use PTR_ERR value instead of -ENOMEM

It's nicer to return the PTR_ERR() value instead of just returning -ENOMEM. In the current code the PTR_ERR() value is always equal to -ENOMEM so this doesn't actually affect anything, but still...

drivers/md/dm-log.c +1 -1
index 5a08be0..fbd80fb 100644
@@ -455,7 +455,7 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
 			r = PTR_ERR(lc->io_req.client);
 			DMWARN("couldn't allocate disk io client");
 			kfree(lc);
-			return -ENOMEM;
+			return r;
 		}
 
 		lc->disk_header = vmalloc(buf_size);
#1 lore raw

ACK

brassow

Quoted 25 lines · Dan Carpenter

It's nicer to return the PTR_ERR() value instead of just returning

(quoted diff) +0 -2
-ENOMEM.  In the current code the PTR_ERR() value is always equal to
-ENOMEM so this doesn't actually affect anything, but still...
drivers/md/dm-log.c +1 -1
index 5a08be0..fbd80fb 100644
@@ -455,7 +455,7 @@ static int create_log_context(struct  
 dm_dirty_log *log, struct dm_target *ti,
 			r = PTR_ERR(lc->io_req.client);
 			DMWARN("couldn't allocate disk io client");
 			kfree(lc);
-			return -ENOMEM;
+			return r;
 		}
 
		lc->disk_header = vmalloc(buf_size);

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel