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/83417d4366e7
branches:  trunk
changeset: 930778:83417d4366e7
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 d0fbfec56842 -r 83417d4366e7 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