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): Convert conditional to KASSERT in uvi...



details:   https://anonhg.NetBSD.org/src/rev/b7752f7679e6
branches:  trunk
changeset: 365285:b7752f7679e6
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Apr 17 13:17:06 2022 +0000

description:
uvideo(4): Convert conditional to KASSERT in uvideo_unit_alloc.

The one caller guarantees the condition already.

diffstat:

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

diffs (28 lines):

diff -r a4bade64b46a -r b7752f7679e6 sys/dev/usb/uvideo.c
--- a/sys/dev/usb/uvideo.c      Sun Apr 17 13:16:52 2022 +0000
+++ b/sys/dev/usb/uvideo.c      Sun Apr 17 13:17:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvideo.c,v 1.75 2022/04/17 13:16:11 riastradh Exp $    */
+/*     $NetBSD: uvideo.c,v 1.76 2022/04/17 13:17:06 riastradh Exp $    */
 
 /*
  * Copyright (c) 2008 Patrick Mahoney
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.75 2022/04/17 13:16:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.76 2022/04/17 13:17:06 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -870,8 +870,7 @@
        struct uvideo_unit *vu;
        usbd_status err;
 
-       if (desc->bDescriptorType != UDESC_CS_INTERFACE)
-               return NULL;
+       KASSERT(desc->bDescriptorType == UDESC_CS_INTERFACE);
 
        vu = kmem_zalloc(sizeof(*vu), KM_SLEEP);
        err = uvideo_unit_init(vu, desc);



Home | Main Index | Thread Index | Old Index