Commit f123a327 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB core

added check for num_minors at registration time to catch buggy drivers.
parent 7cd6abc5
...@@ -115,6 +115,11 @@ int usb_register(struct usb_driver *new_driver) ...@@ -115,6 +115,11 @@ int usb_register(struct usb_driver *new_driver)
{ {
int retval = 0; int retval = 0;
if ((new_driver->fops) && (new_driver->num_minors == 0)) {
err ("%s driver must specify num_minors", new_driver->name);
return -EINVAL;
}
#ifndef CONFIG_USB_DYNAMIC_MINORS #ifndef CONFIG_USB_DYNAMIC_MINORS
if (new_driver->fops != NULL) { if (new_driver->fops != NULL) {
retval = usb_register_minors (new_driver, new_driver->num_minors, new_driver->minor); retval = usb_register_minors (new_driver, new_driver->num_minors, new_driver->minor);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment