hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/usb/usbip/vhci_hcd.c
....@@ -516,6 +516,7 @@
516516 case USB_PORT_FEAT_U1_TIMEOUT:
517517 usbip_dbg_vhci_rh(
518518 " SetPortFeature: USB_PORT_FEAT_U1_TIMEOUT\n");
519
+ fallthrough;
519520 case USB_PORT_FEAT_U2_TIMEOUT:
520521 usbip_dbg_vhci_rh(
521522 " SetPortFeature: USB_PORT_FEAT_U2_TIMEOUT\n");
....@@ -568,7 +569,7 @@
568569 "supported for USB 2.0 roothub\n");
569570 goto error;
570571 }
571
- /* FALLS THROUGH */
572
+ fallthrough;
572573 case USB_PORT_FEAT_RESET:
573574 usbip_dbg_vhci_rh(
574575 " SetPortFeature: USB_PORT_FEAT_RESET\n");
....@@ -591,8 +592,7 @@
591592
592593 /* 50msec reset signaling */
593594 vhci_hcd->re_timeout = jiffies + msecs_to_jiffies(50);
594
-
595
- /* FALLS THROUGH */
595
+ fallthrough;
596596 default:
597597 usbip_dbg_vhci_rh(" SetPortFeature: default %d\n",
598598 wValue);
....@@ -664,14 +664,8 @@
664664 static void vhci_tx_urb(struct urb *urb, struct vhci_device *vdev)
665665 {
666666 struct vhci_priv *priv;
667
- struct vhci_hcd *vhci_hcd;
667
+ struct vhci_hcd *vhci_hcd = vdev_to_vhci_hcd(vdev);
668668 unsigned long flags;
669
-
670
- if (!vdev) {
671
- pr_err("could not get virtual device");
672
- return;
673
- }
674
- vhci_hcd = vdev_to_vhci_hcd(vdev);
675669
676670 priv = kzalloc(sizeof(struct vhci_priv), GFP_ATOMIC);
677671 if (!priv) {
....@@ -813,8 +807,14 @@
813807 usb_hcd_unlink_urb_from_ep(hcd, urb);
814808 no_need_unlink:
815809 spin_unlock_irqrestore(&vhci->lock, flags);
816
- if (!ret)
810
+ if (!ret) {
811
+ /* usb_hcd_giveback_urb() should be called with
812
+ * irqs disabled
813
+ */
814
+ local_irq_disable();
817815 usb_hcd_giveback_urb(hcd, urb, urb->status);
816
+ local_irq_enable();
817
+ }
818818 return ret;
819819 }
820820
....@@ -1235,12 +1235,12 @@
12351235 if (id == 0 && usb_hcd_is_primary_hcd(hcd)) {
12361236 err = vhci_init_attr_group();
12371237 if (err) {
1238
- pr_err("init attr group\n");
1238
+ dev_err(hcd_dev(hcd), "init attr group failed, err = %d\n", err);
12391239 return err;
12401240 }
12411241 err = sysfs_create_group(&hcd_dev(hcd)->kobj, &vhci_attr_group);
12421242 if (err) {
1243
- pr_err("create sysfs files\n");
1243
+ dev_err(hcd_dev(hcd), "create sysfs files failed, err = %d\n", err);
12441244 vhci_finish_attr_group();
12451245 return err;
12461246 }