Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[pandora-kernel.git] / net / ieee802154 / wpan-class.c
index 3d803a1..1627ef2 100644 (file)
@@ -147,13 +147,15 @@ struct wpan_phy *wpan_phy_alloc(size_t priv_size)
        struct wpan_phy *phy = kzalloc(sizeof(*phy) + priv_size,
                        GFP_KERNEL);
 
+       if (!phy)
+               goto out;
        mutex_lock(&wpan_phy_mutex);
        phy->idx = wpan_phy_idx++;
        if (unlikely(!wpan_phy_idx_valid(phy->idx))) {
                wpan_phy_idx--;
                mutex_unlock(&wpan_phy_mutex);
                kfree(phy);
-               return NULL;
+               goto out;
        }
        mutex_unlock(&wpan_phy_mutex);
 
@@ -168,6 +170,9 @@ struct wpan_phy *wpan_phy_alloc(size_t priv_size)
        phy->current_page = 0; /* for compatibility */
 
        return phy;
+
+out:
+       return NULL;
 }
 EXPORT_SYMBOL(wpan_phy_alloc);