Skip to content

Commit 9a5729f

Browse files
oneukumgregkh
authored andcommitted
USB: sisusbvga: fix oops in error path of sisusb_probe
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]>
1 parent ea26111 commit 9a5729f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

drivers/usb/misc/sisusbvga/sisusb.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,6 +3029,13 @@ static int sisusb_probe(struct usb_interface *intf,
30293029

30303030
mutex_init(&(sisusb->lock));
30313031

3032+
sisusb->sisusb_dev = dev;
3033+
sisusb->vrambase = SISUSB_PCI_MEMBASE;
3034+
sisusb->mmiobase = SISUSB_PCI_MMIOBASE;
3035+
sisusb->mmiosize = SISUSB_PCI_MMIOSIZE;
3036+
sisusb->ioportbase = SISUSB_PCI_IOPORTBASE;
3037+
/* Everything else is zero */
3038+
30323039
/* Register device */
30333040
retval = usb_register_dev(intf, &usb_sisusb_class);
30343041
if (retval) {
@@ -3039,13 +3046,7 @@ static int sisusb_probe(struct usb_interface *intf,
30393046
goto error_1;
30403047
}
30413048

3042-
sisusb->sisusb_dev = dev;
3043-
sisusb->minor = intf->minor;
3044-
sisusb->vrambase = SISUSB_PCI_MEMBASE;
3045-
sisusb->mmiobase = SISUSB_PCI_MMIOBASE;
3046-
sisusb->mmiosize = SISUSB_PCI_MMIOSIZE;
3047-
sisusb->ioportbase = SISUSB_PCI_IOPORTBASE;
3048-
/* Everything else is zero */
3049+
sisusb->minor = intf->minor;
30493050

30503051
/* Allocate buffers */
30513052
sisusb->ibufsize = SISUSB_IBUF_SIZE;

0 commit comments

Comments
 (0)