Reorder to test for null before null deref in debug code

This commit is contained in:
maya 2017-10-10 11:43:26 +00:00
parent cd9dd986ea
commit ad7c2f3929
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: usbdi_util.c,v 1.67 2017/10/10 11:40:54 maya Exp $ */
/* $NetBSD: usbdi_util.c,v 1.68 2017/10/10 11:43:26 maya Exp $ */
/*
* Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.67 2017/10/10 11:40:54 maya Exp $");
__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.68 2017/10/10 11:43:26 maya Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -314,9 +314,10 @@ usbd_get_protocol(struct usbd_interface *iface, uint8_t *report)
USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
DPRINTFN(4, "iface=%p, endpt=%d", iface, id->bInterfaceNumber, 0, 0);
if (id == NULL)
return USBD_IOERROR;
DPRINTFN(4, "iface=%p, endpt=%d", iface, id->bInterfaceNumber, 0, 0);
usbd_interface2device_handle(iface, &dev);
req.bmRequestType = UT_READ_CLASS_INTERFACE;
req.bRequest = UR_GET_PROTOCOL;