Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/xen DRY - use pages for sizeof() for the frame ...



details:   https://anonhg.NetBSD.org/src/rev/7d4970e101e4
branches:  trunk
changeset: 1009151:7d4970e101e4
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Tue Apr 14 07:41:05 2020 +0000

description:
DRY - use pages for sizeof() for the frame allocations, so it get's allocated
the correct size without repeating the type

diffstat:

 sys/arch/xen/xen/xengnt.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 9bf6a4fc1288 -r 7d4970e101e4 sys/arch/xen/xen/xengnt.c
--- a/sys/arch/xen/xen/xengnt.c Tue Apr 14 07:38:12 2020 +0000
+++ b/sys/arch/xen/xen/xengnt.c Tue Apr 14 07:41:05 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xengnt.c,v 1.34 2020/04/14 07:38:12 jdolecek Exp $      */
+/*      $NetBSD: xengnt.c,v 1.35 2020/04/14 07:41:05 jdolecek Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.34 2020/04/14 07:38:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.35 2020/04/14 07:41:05 jdolecek Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -191,7 +191,7 @@
 
        KASSERT(mutex_owned(&grant_lock));
 
-       sz = gnt_status_frames * sizeof(uint64_t);
+       sz = gnt_status_frames * sizeof(*pages);
        pages = kmem_alloc(sz, KM_NOSLEEP);
        if (pages == NULL)
                return ENOMEM;
@@ -247,7 +247,7 @@
        if (gnt_nr_grant_frames == gnt_max_grant_frames)
                return ENOMEM;
 
-       sz = nframes_new * sizeof(u_long);
+       sz = nframes_new * sizeof(*pages);
        pages = kmem_alloc(sz, KM_NOSLEEP);
        if (pages == NULL)
                return ENOMEM;



Home | Main Index | Thread Index | Old Index