Skip to content

Commit

Permalink
USB: sisusbvga: fix oops in error path of sisusb_probe
Browse files Browse the repository at this point in the history
The pointer used to log a failure of usb_register_dev() must
be set before the error is logged.

v2: fix that minor is not available before registration

Signed-off-by: oliver Neukum <[email protected]>
Reported-by: [email protected]
Fixes: 7b5cd5f ("USB: SisUSB2VGA: Convert printk to dev_* macros")
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
oneukum authored and gregkh committed May 21, 2019
1 parent ea26111 commit 9a5729f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions drivers/usb/misc/sisusbvga/sisusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3029,6 +3029,13 @@ static int sisusb_probe(struct usb_interface *intf,

mutex_init(&(sisusb->lock));

sisusb->sisusb_dev = dev;
sisusb->vrambase = SISUSB_PCI_MEMBASE;
sisusb->mmiobase = SISUSB_PCI_MMIOBASE;
sisusb->mmiosize = SISUSB_PCI_MMIOSIZE;
sisusb->ioportbase = SISUSB_PCI_IOPORTBASE;
/* Everything else is zero */

/* Register device */
retval = usb_register_dev(intf, &usb_sisusb_class);
if (retval) {
Expand All @@ -3039,13 +3046,7 @@ static int sisusb_probe(struct usb_interface *intf,
goto error_1;
}

sisusb->sisusb_dev = dev;
sisusb->minor = intf->minor;
sisusb->vrambase = SISUSB_PCI_MEMBASE;
sisusb->mmiobase = SISUSB_PCI_MMIOBASE;
sisusb->mmiosize = SISUSB_PCI_MMIOSIZE;
sisusb->ioportbase = SISUSB_PCI_IOPORTBASE;
/* Everything else is zero */
sisusb->minor = intf->minor;

/* Allocate buffers */
sisusb->ibufsize = SISUSB_IBUF_SIZE;
Expand Down

0 comments on commit 9a5729f

Please sign in to comment.