Use a local pointer to reference the urb instead of dereferencing the priv->urb member all over the function. Signed-off-by: Tobias Klauser <tklauser@xxxxxxxxxx> --- drivers/staging/usbip/stub_rx.c | 44 +++++++++++++++++++------------------- 1 files changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c index 538fb9e..8d40e5e 100644 --- a/drivers/staging/usbip/stub_rx.c +++ b/drivers/staging/usbip/stub_rx.c @@ -469,6 +469,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev, { int ret; struct stub_priv *priv; + struct urb *urb; struct usbip_device *ud = &sdev->ud; struct usb_device *udev = sdev->udev; int pipe = get_pipe(sdev, pdu->base.ep, pdu->base.direction); @@ -479,12 +480,14 @@ static void stub_recv_cmd_submit(struct stub_device *sdev, /* setup a urb */ if (usb_pipeisoc(pipe)) - priv->urb = usb_alloc_urb(pdu->u.cmd_submit.number_of_packets, - GFP_KERNEL); + urb = usb_alloc_urb(pdu->u.cmd_submit.number_of_packets, + GFP_KERNEL); else - priv->urb = usb_alloc_urb(0, GFP_KERNEL); + urb = usb_alloc_urb(0, GFP_KERNEL); - if (!priv->urb) { + priv->urb = urb; + + if (!urb) { dev_err(&sdev->interface->dev, "malloc urb\n"); usbip_event_add(ud, SDEV_EVENT_ERROR_MALLOC); return; @@ -492,10 +495,10 @@ static void stub_recv_cmd_submit(struct stub_device *sdev, /* set priv->urb->transfer_buffer */ if (pdu->u.cmd_submit.transfer_buffer_length > 0) { - priv->urb->transfer_buffer = + urb->transfer_buffer = kzalloc(pdu->u.cmd_submit.transfer_buffer_length, GFP_KERNEL); - if (!priv->urb->transfer_buffer) { + if (!urb->transfer_buffer) { dev_err(&sdev->interface->dev, "malloc x_buff\n"); usbip_event_add(ud, SDEV_EVENT_ERROR_MALLOC); return; @@ -503,43 +506,40 @@ static void stub_recv_cmd_submit(struct stub_device *sdev, } /* set priv->urb->setup_packet */ - priv->urb->setup_packet = kmemdup(&pdu->u.cmd_submit.setup, 8, - GFP_KERNEL); - if (!priv->urb->setup_packet) { + urb->setup_packet = kmemdup(&pdu->u.cmd_submit.setup, 8, GFP_KERNEL); + if (!urb->setup_packet) { dev_err(&sdev->interface->dev, "allocate setup_packet\n"); usbip_event_add(ud, SDEV_EVENT_ERROR_MALLOC); return; } /* set other members from the base header of pdu */ - priv->urb->context = (void *) priv; - priv->urb->dev = udev; - priv->urb->pipe = pipe; - priv->urb->complete = stub_complete; - - usbip_pack_pdu(pdu, priv->urb, USBIP_CMD_SUBMIT, 0); + urb->context = (void *) priv; + urb->dev = udev; + urb->pipe = pipe; + urb->complete = stub_complete; + usbip_pack_pdu(pdu, urb, USBIP_CMD_SUBMIT, 0); - if (usbip_recv_xbuff(ud, priv->urb) < 0) + if (usbip_recv_xbuff(ud, urb) < 0) return; - if (usbip_recv_iso(ud, priv->urb) < 0) + if (usbip_recv_iso(ud, urb) < 0) return; /* no need to submit an intercepted request, but harmless? */ - tweak_special_requests(priv->urb); + tweak_special_requests(urb); - masking_bogus_flags(priv->urb); + masking_bogus_flags(urb); /* urb is now ready to submit */ - ret = usb_submit_urb(priv->urb, GFP_KERNEL); - + ret = usb_submit_urb(urb, GFP_KERNEL); if (ret == 0) usbip_dbg_stub_rx("submit urb ok, seqnum %u\n", pdu->base.seqnum); else { dev_err(&sdev->interface->dev, "submit_urb error, %d\n", ret); usbip_dump_header(pdu); - usbip_dump_urb(priv->urb); + usbip_dump_urb(urb); /* * Pessimistic. -- 1.7.0.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel