Skip to contentSkip to conversation

kmem_cache_alloc doesn't return ERR_PTR so no need to check for it.

PATCH New Chris Samuel 1 participant 1 message Nov 13, 2010 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kmem_cache_alloc doesn't return ERR_PTR so no need to check for it.

According to scripts/coccinelle/null/eno.cocci "The various basic memory allocation functions don't return ERR_PTR" so there's no point in calling IS_ERR() on the return value from them, the existing test is good enough.

---
 fs/btrfs/extent_map.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/btrfs/extent_map.c +1 -1
index 23cb8da..8797704 100644
@@ -50,7 +50,7 @@ struct extent_map *alloc_extent_map(gfp_t mask)
 {
        struct extent_map *em;
        em = kmem_cache_alloc(extent_map_cache, mask);
-       if (!em || IS_ERR(em))
+       if (!em)
                return em;
        em->in_tree = 0;
        em->flags = 0;
Signature · 4 lines
1.7.0.4

-- 
 Chris Samuel  :  http://www.csamuel.org/  :  Melbourne, VIC