Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Use kmem_zalloc to allocate pppoe_softc



details:   https://anonhg.NetBSD.org/src/rev/a309d0f68909
branches:  trunk
changeset: 982526:a309d0f68909
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Fri Apr 16 01:32:04 2021 +0000

description:
Use kmem_zalloc to allocate pppoe_softc

diffstat:

 sys/net/if_pppoe.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r e595abaa499d -r a309d0f68909 sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c        Fri Apr 16 01:28:51 2021 +0000
+++ b/sys/net/if_pppoe.c        Fri Apr 16 01:32:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.164 2021/04/16 01:28:51 yamaguchi Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.165 2021/04/16 01:32:04 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.164 2021/04/16 01:28:51 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.165 2021/04/16 01:32:04 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -341,7 +341,7 @@
        struct pppoe_softc *sc;
        int rv;
 
-       sc = malloc(sizeof(struct pppoe_softc), M_DEVBUF, M_WAITOK|M_ZERO);
+       sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
 
        rw_init(&sc->sc_lock);
        pppoe_softc_genid(&sc->sc_id);
@@ -408,7 +408,7 @@
        workqueue_destroy(sc->sc_timeout_wq);
 destroy_sclock:
        rw_destroy(&sc->sc_lock);
-       free(sc, M_DEVBUF);
+       kmem_free(sc, sizeof(*sc));
 
        return rv;
 }
@@ -449,7 +449,7 @@
        PPPOE_UNLOCK(sc);
        rw_destroy(&sc->sc_lock);
 
-       free(sc, M_DEVBUF);
+       kmem_free(sc, sizeof(*sc));
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index