Don't dereference NULL pointer when no device attaches.

This commit is contained in:
augustss 2002-01-27 18:10:34 +00:00
parent 9a9a577188
commit 9cdd3fd977

View File

@ -1,4 +1,4 @@
/* $NetBSD: uhidev.c,v 1.3 2001/12/29 20:50:16 augustss Exp $ */ /* $NetBSD: uhidev.c,v 1.4 2002/01/27 18:10:34 augustss Exp $ */
/* /*
* Copyright (c) 2001 The NetBSD Foundation, Inc. * Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -224,9 +224,9 @@ USB_ATTACH(uhidev)
dev = (struct uhidev *)config_found_sm(self, &uha, dev = (struct uhidev *)config_found_sm(self, &uha,
uhidevprint, uhidevsubmatch); uhidevprint, uhidevsubmatch);
sc->sc_subdevs[repid] = dev; sc->sc_subdevs[repid] = dev;
if (dev != NULL) {
dev->sc_in_rep_size = repsizes[repid]; dev->sc_in_rep_size = repsizes[repid];
#ifdef DIAGNOSTIC #ifdef DIAGNOSTIC
if (dev != NULL) {
DPRINTF(("uhidev_match: repid=%d dev=%p\n", DPRINTF(("uhidev_match: repid=%d dev=%p\n",
repid, dev)); repid, dev));
if (dev->sc_intr == NULL) { if (dev->sc_intr == NULL) {
@ -234,10 +234,10 @@ USB_ATTACH(uhidev)
USBDEVNAME(sc->sc_dev)); USBDEVNAME(sc->sc_dev));
USB_ATTACH_ERROR_RETURN; USB_ATTACH_ERROR_RETURN;
} }
}
#endif #endif
} }
} }
}
USB_ATTACH_SUCCESS_RETURN; USB_ATTACH_SUCCESS_RETURN;
} }