ipc_lock_object(&ipcp->shm_perm);
 }
 
-static void __shm_free(struct shmid_kernel *shp)
-{
-       kvfree(shp);
-}
-
 static void shm_rcu_free(struct rcu_head *head)
 {
        struct kern_ipc_perm *ptr = container_of(head, struct kern_ipc_perm,
        struct shmid_kernel *shp = container_of(ptr, struct shmid_kernel,
                                                        shm_perm);
        security_shm_free(shp);
-       __shm_free(shp);
+       kvfree(shp);
 }
 
 static inline void shm_rmid(struct ipc_namespace *ns, struct shmid_kernel *s)
 #endif
 };
 
-static struct shmid_kernel *shm_alloc(void)
-{
-       struct shmid_kernel *shp;
-
-       shp = kvmalloc(sizeof(*shp), GFP_KERNEL);
-       if (unlikely(!shp))
-               return NULL;
-
-       return shp;
-}
-
 /**
  * newseg - Create a new shared memory segment
  * @ns: namespace
                        ns->shm_tot + numpages > ns->shm_ctlall)
                return -ENOSPC;
 
-       shp = shm_alloc();
-       if (!shp)
+       shp = kvmalloc(sizeof(*shp), GFP_KERNEL);
+       if (unlikely(!shp))
                return -ENOMEM;
 
        shp->shm_perm.key = key;
        shp->shm_perm.security = NULL;
        error = security_shm_alloc(shp);
        if (error) {
-               __shm_free(shp);
+               kvfree(shp);
                return error;
        }