aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/atm/cxacru.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index a73e714288e5..a51eeedc18d4 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -482,7 +482,9 @@ static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm,
482 int rbuflen = ((rsize - 1) / stride + 1) * CMD_PACKET_SIZE; 482 int rbuflen = ((rsize - 1) / stride + 1) * CMD_PACKET_SIZE;
483 483
484 if (wbuflen > PAGE_SIZE || rbuflen > PAGE_SIZE) { 484 if (wbuflen > PAGE_SIZE || rbuflen > PAGE_SIZE) {
485 dbg("too big transfer requested"); 485 if (printk_ratelimit())
486 usb_err(instance->usbatm, "requested transfer size too large (%d, %d)\n",
487 wbuflen, rbuflen);
486 ret = -ENOMEM; 488 ret = -ENOMEM;
487 goto fail; 489 goto fail;
488 } 490 }
@@ -493,8 +495,9 @@ static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm,
493 init_completion(&instance->rcv_done); 495 init_completion(&instance->rcv_done);
494 ret = usb_submit_urb(instance->rcv_urb, GFP_KERNEL); 496 ret = usb_submit_urb(instance->rcv_urb, GFP_KERNEL);
495 if (ret < 0) { 497 if (ret < 0) {
496 dbg("submitting read urb for cm %#x failed", cm); 498 if (printk_ratelimit())
497 ret = ret; 499 usb_err(instance->usbatm, "submit of read urb for cm %#x failed (%d)\n",
500 cm, ret);
498 goto fail; 501 goto fail;
499 } 502 }
500 503
@@ -510,27 +513,29 @@ static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm,
510 init_completion(&instance->snd_done); 513 init_completion(&instance->snd_done);
511 ret = usb_submit_urb(instance->snd_urb, GFP_KERNEL); 514 ret = usb_submit_urb(instance->snd_urb, GFP_KERNEL);
512 if (ret < 0) { 515 if (ret < 0) {
513 dbg("submitting write urb for cm %#x failed", cm); 516 if (printk_ratelimit())
514 ret = ret; 517 usb_err(instance->usbatm, "submit of write urb for cm %#x failed (%d)\n",
518 cm, ret);
515 goto fail; 519 goto fail;
516 } 520 }
517 521
518 ret = cxacru_start_wait_urb(instance->snd_urb, &instance->snd_done, NULL); 522 ret = cxacru_start_wait_urb(instance->snd_urb, &instance->snd_done, NULL);
519 if (ret < 0) { 523 if (ret < 0) {
520 dbg("sending cm %#x failed", cm); 524 if (printk_ratelimit())
521 ret = ret; 525 usb_err(instance->usbatm, "send of cm %#x failed (%d)\n", cm, ret);
522 goto fail; 526 goto fail;
523 } 527 }
524 528
525 ret = cxacru_start_wait_urb(instance->rcv_urb, &instance->rcv_done, &actlen); 529 ret = cxacru_start_wait_urb(instance->rcv_urb, &instance->rcv_done, &actlen);
526 if (ret < 0) { 530 if (ret < 0) {
527 dbg("receiving cm %#x failed", cm); 531 if (printk_ratelimit())
528 ret = ret; 532 usb_err(instance->usbatm, "receive of cm %#x failed (%d)\n", cm, ret);
529 goto fail; 533 goto fail;
530 } 534 }
531 if (actlen % CMD_PACKET_SIZE || !actlen) { 535 if (actlen % CMD_PACKET_SIZE || !actlen) {
532 dbg("response is not a positive multiple of %d: %#x", 536 if (printk_ratelimit())
533 CMD_PACKET_SIZE, actlen); 537 usb_err(instance->usbatm, "invalid response length to cm %#x: %d\n",
538 cm, actlen);
534 ret = -EIO; 539 ret = -EIO;
535 goto fail; 540 goto fail;
536 } 541 }
@@ -538,12 +543,16 @@ static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm,
538 /* check the return status and copy the data to the output buffer, if needed */ 543 /* check the return status and copy the data to the output buffer, if needed */
539 for (offb = offd = 0; offd < rsize && offb < actlen; offb += CMD_PACKET_SIZE) { 544 for (offb = offd = 0; offd < rsize && offb < actlen; offb += CMD_PACKET_SIZE) {
540 if (rbuf[offb] != cm) { 545 if (rbuf[offb] != cm) {
541 dbg("wrong cm %#x in response", rbuf[offb]); 546 if (printk_ratelimit())
547 usb_err(instance->usbatm, "wrong cm %#x in response to cm %#x\n",
548 rbuf[offb], cm);
542 ret = -EIO; 549 ret = -EIO;
543 goto fail; 550 goto fail;
544 } 551 }
545 if (rbuf[offb + 1] != CM_STATUS_SUCCESS) { 552 if (rbuf[offb + 1] != CM_STATUS_SUCCESS) {
546 dbg("response failed: %#x", rbuf[offb + 1]); 553 if (printk_ratelimit())
554 usb_err(instance->usbatm, "response to cm %#x failed: %#x\n",
555 cm, rbuf[offb + 1]);
547 ret = -EIO; 556 ret = -EIO;
548 goto fail; 557 goto fail;
549 } 558 }
@@ -582,14 +591,18 @@ static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_requ
582 for (offb = 0; offb < len; ) { 591 for (offb = 0; offb < len; ) {
583 int l = le32_to_cpu(buf[offb++]); 592 int l = le32_to_cpu(buf[offb++]);
584 if (l > stride || l > (len - offb) / 2) { 593 if (l > stride || l > (len - offb) / 2) {
585 dbg("wrong data length %#x in response", l); 594 if (printk_ratelimit())
595 usb_err(instance->usbatm, "invalid data length from cm %#x: %d\n",
596 cm, l);
586 ret = -EIO; 597 ret = -EIO;
587 goto cleanup; 598 goto cleanup;
588 } 599 }
589 while (l--) { 600 while (l--) {
590 offd = le32_to_cpu(buf[offb++]); 601 offd = le32_to_cpu(buf[offb++]);
591 if (offd >= size) { 602 if (offd >= size) {
592 dbg("wrong index %#x in response", offd); 603 if (printk_ratelimit())
604 usb_err(instance->usbatm, "wrong index #%x in response to cm #%x\n",
605 offd, cm);
593 ret = -EIO; 606 ret = -EIO;
594 goto cleanup; 607 goto cleanup;
595 } 608 }