Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb uvideo(4): Use sizeof(*p), not sizeof(T), for km...



details:   https://anonhg.NetBSD.org/src/rev/9e5e6cd4c878
branches:  trunk
changeset: 365282:9e5e6cd4c878
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Apr 17 13:16:11 2022 +0000

description:
uvideo(4): Use sizeof(*p), not sizeof(T), for kmem_alloc/free.

No functional change intended.

diffstat:

 sys/dev/usb/uvideo.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (59 lines):

diff -r 4e86df371511 -r 9e5e6cd4c878 sys/dev/usb/uvideo.c
--- a/sys/dev/usb/uvideo.c      Sun Apr 17 13:15:48 2022 +0000
+++ b/sys/dev/usb/uvideo.c      Sun Apr 17 13:16:11 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvideo.c,v 1.74 2022/04/17 13:15:48 riastradh Exp $    */
+/*     $NetBSD: uvideo.c,v 1.75 2022/04/17 13:16:11 riastradh Exp $    */
 
 /*
  * Copyright (c) 2008 Patrick Mahoney
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.74 2022/04/17 13:15:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.75 2022/04/17 13:16:11 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -774,7 +774,7 @@
 static struct uvideo_stream *
 uvideo_stream_alloc(void)
 {
-       return kmem_zalloc(sizeof(struct uvideo_stream), KM_SLEEP);
+       return kmem_zalloc(sizeof(*uvideo_stream_alloc()), KM_SLEEP);
 }
 
 
@@ -1287,11 +1287,11 @@
        /* free linked-list of formats and pixel formats */
        while ((format = SIMPLEQ_FIRST(&vs->vs_formats)) != NULL) {
                SIMPLEQ_REMOVE_HEAD(&vs->vs_formats, entries);
-               kmem_free(format, sizeof(struct uvideo_format));
+               kmem_free(format, sizeof(*format));
        }
        while ((pixel_format = SIMPLEQ_FIRST(&vs->vs_pixel_formats)) != NULL) {
                SIMPLEQ_REMOVE_HEAD(&vs->vs_pixel_formats, entries);
-               kmem_free(pixel_format, sizeof(struct uvideo_pixel_format));
+               kmem_free(pixel_format, sizeof(*pixel_format));
        }
 
        kmem_free(vs, sizeof(*vs));
@@ -1387,7 +1387,7 @@
        {
                uvdesc = (const uvideo_descriptor_t *) usb_desc_iter_next(iter);
 
-               format = kmem_zalloc(sizeof(struct uvideo_format), KM_SLEEP);
+               format = kmem_zalloc(sizeof(*format), KM_SLEEP);
                format->format.pixel_format = pixel_format;
 
                switch (format_desc->bDescriptorSubtype) {
@@ -1475,7 +1475,7 @@
                        /* shouldn't ever get here */
                        DPRINTF(("uvideo: unknown frame based format %d\n",
                                 format_desc->bDescriptorSubtype));
-                       kmem_free(format, sizeof(struct uvideo_format));
+                       kmem_free(format, sizeof(*format));
                        return USBD_INVAL;
                }
 



Home | Main Index | Thread Index | Old Index