Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

USB: core: Change configuration warnings to notices

It has been pointed out that the kernel log messages warning about
problems in USB configuration and related descriptors are vexing for
users. The warning log level has a fairly high priority, but the user
can do nothing to fix the underlying errors in the device's firmware.

To reduce the amount of useless information produced by tools that
filter high-priority log messages, we can change these warnings to
notices, i.e., change dev_warn() to dev_notice(). The same holds for
a few messages that currently use dev_err(): Unless they indicate a
failure that might make a device unusable (such as inability to
transfer a config descriptor), change them to dev_notice() also.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216630
Suggested-by: Artem S. Tashkinov <aros@gmx.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/Y2KzPx0h6z1jXCuN@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alan Stern and committed by
Greg Kroah-Hartman
7a09c126 8527e942

+41 -41
+41 -41
drivers/usb/core/config.c
··· 61 61 desc = (struct usb_ssp_isoc_ep_comp_descriptor *) buffer; 62 62 if (desc->bDescriptorType != USB_DT_SSP_ISOC_ENDPOINT_COMP || 63 63 size < USB_DT_SSP_ISOC_EP_COMP_SIZE) { 64 - dev_warn(ddev, "Invalid SuperSpeedPlus isoc endpoint companion" 64 + dev_notice(ddev, "Invalid SuperSpeedPlus isoc endpoint companion" 65 65 "for config %d interface %d altsetting %d ep %d.\n", 66 66 cfgno, inum, asnum, ep->desc.bEndpointAddress); 67 67 return; ··· 83 83 84 84 if (desc->bDescriptorType != USB_DT_SS_ENDPOINT_COMP || 85 85 size < USB_DT_SS_EP_COMP_SIZE) { 86 - dev_warn(ddev, "No SuperSpeed endpoint companion for config %d " 86 + dev_notice(ddev, "No SuperSpeed endpoint companion for config %d " 87 87 " interface %d altsetting %d ep %d: " 88 88 "using minimum values\n", 89 89 cfgno, inum, asnum, ep->desc.bEndpointAddress); ··· 109 109 110 110 /* Check the various values */ 111 111 if (usb_endpoint_xfer_control(&ep->desc) && desc->bMaxBurst != 0) { 112 - dev_warn(ddev, "Control endpoint with bMaxBurst = %d in " 112 + dev_notice(ddev, "Control endpoint with bMaxBurst = %d in " 113 113 "config %d interface %d altsetting %d ep %d: " 114 114 "setting to zero\n", desc->bMaxBurst, 115 115 cfgno, inum, asnum, ep->desc.bEndpointAddress); 116 116 ep->ss_ep_comp.bMaxBurst = 0; 117 117 } else if (desc->bMaxBurst > 15) { 118 - dev_warn(ddev, "Endpoint with bMaxBurst = %d in " 118 + dev_notice(ddev, "Endpoint with bMaxBurst = %d in " 119 119 "config %d interface %d altsetting %d ep %d: " 120 120 "setting to 15\n", desc->bMaxBurst, 121 121 cfgno, inum, asnum, ep->desc.bEndpointAddress); ··· 125 125 if ((usb_endpoint_xfer_control(&ep->desc) || 126 126 usb_endpoint_xfer_int(&ep->desc)) && 127 127 desc->bmAttributes != 0) { 128 - dev_warn(ddev, "%s endpoint with bmAttributes = %d in " 128 + dev_notice(ddev, "%s endpoint with bmAttributes = %d in " 129 129 "config %d interface %d altsetting %d ep %d: " 130 130 "setting to zero\n", 131 131 usb_endpoint_xfer_control(&ep->desc) ? "Control" : "Bulk", ··· 134 134 ep->ss_ep_comp.bmAttributes = 0; 135 135 } else if (usb_endpoint_xfer_bulk(&ep->desc) && 136 136 desc->bmAttributes > 16) { 137 - dev_warn(ddev, "Bulk endpoint with more than 65536 streams in " 137 + dev_notice(ddev, "Bulk endpoint with more than 65536 streams in " 138 138 "config %d interface %d altsetting %d ep %d: " 139 139 "setting to max\n", 140 140 cfgno, inum, asnum, ep->desc.bEndpointAddress); ··· 142 142 } else if (usb_endpoint_xfer_isoc(&ep->desc) && 143 143 !USB_SS_SSP_ISOC_COMP(desc->bmAttributes) && 144 144 USB_SS_MULT(desc->bmAttributes) > 3) { 145 - dev_warn(ddev, "Isoc endpoint has Mult of %d in " 145 + dev_notice(ddev, "Isoc endpoint has Mult of %d in " 146 146 "config %d interface %d altsetting %d ep %d: " 147 147 "setting to 3\n", 148 148 USB_SS_MULT(desc->bmAttributes), ··· 160 160 else 161 161 max_tx = 999999; 162 162 if (le16_to_cpu(desc->wBytesPerInterval) > max_tx) { 163 - dev_warn(ddev, "%s endpoint with wBytesPerInterval of %d in " 163 + dev_notice(ddev, "%s endpoint with wBytesPerInterval of %d in " 164 164 "config %d interface %d altsetting %d ep %d: " 165 165 "setting to %d\n", 166 166 usb_endpoint_xfer_isoc(&ep->desc) ? "Isoc" : "Int", ··· 273 273 else if (d->bLength >= USB_DT_ENDPOINT_SIZE) 274 274 n = USB_DT_ENDPOINT_SIZE; 275 275 else { 276 - dev_warn(ddev, "config %d interface %d altsetting %d has an " 276 + dev_notice(ddev, "config %d interface %d altsetting %d has an " 277 277 "invalid endpoint descriptor of length %d, skipping\n", 278 278 cfgno, inum, asnum, d->bLength); 279 279 goto skip_to_next_endpoint_or_interface_descriptor; ··· 281 281 282 282 i = d->bEndpointAddress & ~USB_ENDPOINT_DIR_MASK; 283 283 if (i >= 16 || i == 0) { 284 - dev_warn(ddev, "config %d interface %d altsetting %d has an " 284 + dev_notice(ddev, "config %d interface %d altsetting %d has an " 285 285 "invalid endpoint with address 0x%X, skipping\n", 286 286 cfgno, inum, asnum, d->bEndpointAddress); 287 287 goto skip_to_next_endpoint_or_interface_descriptor; ··· 293 293 294 294 /* Check for duplicate endpoint addresses */ 295 295 if (config_endpoint_is_duplicate(config, inum, asnum, d)) { 296 - dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", 296 + dev_notice(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", 297 297 cfgno, inum, asnum, d->bEndpointAddress); 298 298 goto skip_to_next_endpoint_or_interface_descriptor; 299 299 } ··· 301 301 /* Ignore some endpoints */ 302 302 if (udev->quirks & USB_QUIRK_ENDPOINT_IGNORE) { 303 303 if (usb_endpoint_is_ignored(udev, ifp, d)) { 304 - dev_warn(ddev, "config %d interface %d altsetting %d has an ignored endpoint with address 0x%X, skipping\n", 304 + dev_notice(ddev, "config %d interface %d altsetting %d has an ignored endpoint with address 0x%X, skipping\n", 305 305 cfgno, inum, asnum, 306 306 d->bEndpointAddress); 307 307 goto skip_to_next_endpoint_or_interface_descriptor; ··· 378 378 } 379 379 } 380 380 if (d->bInterval < i || d->bInterval > j) { 381 - dev_warn(ddev, "config %d interface %d altsetting %d " 381 + dev_notice(ddev, "config %d interface %d altsetting %d " 382 382 "endpoint 0x%X has an invalid bInterval %d, " 383 383 "changing to %d\n", 384 384 cfgno, inum, asnum, ··· 391 391 * them usable, we will try treating them as Interrupt endpoints. 392 392 */ 393 393 if (udev->speed == USB_SPEED_LOW && usb_endpoint_xfer_bulk(d)) { 394 - dev_warn(ddev, "config %d interface %d altsetting %d " 394 + dev_notice(ddev, "config %d interface %d altsetting %d " 395 395 "endpoint 0x%X is Bulk; changing to Interrupt\n", 396 396 cfgno, inum, asnum, d->bEndpointAddress); 397 397 endpoint->desc.bmAttributes = USB_ENDPOINT_XFER_INT; ··· 408 408 */ 409 409 maxp = le16_to_cpu(endpoint->desc.wMaxPacketSize); 410 410 if (maxp == 0 && !(usb_endpoint_xfer_isoc(d) && asnum == 0)) { 411 - dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n", 411 + dev_notice(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n", 412 412 cfgno, inum, asnum, d->bEndpointAddress); 413 413 } 414 414 ··· 439 439 j = maxpacket_maxes[usb_endpoint_type(&endpoint->desc)]; 440 440 441 441 if (maxp > j) { 442 - dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d\n", 442 + dev_notice(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d\n", 443 443 cfgno, inum, asnum, d->bEndpointAddress, maxp, j); 444 444 maxp = j; 445 445 endpoint->desc.wMaxPacketSize = cpu_to_le16(i | maxp); ··· 452 452 */ 453 453 if (udev->speed == USB_SPEED_HIGH && usb_endpoint_xfer_bulk(d)) { 454 454 if (maxp != 512) 455 - dev_warn(ddev, "config %d interface %d altsetting %d " 455 + dev_notice(ddev, "config %d interface %d altsetting %d " 456 456 "bulk endpoint 0x%X has invalid maxpacket %d\n", 457 457 cfgno, inum, asnum, d->bEndpointAddress, 458 458 maxp); ··· 533 533 i < intfc->num_altsetting; 534 534 (++i, ++alt)) { 535 535 if (alt->desc.bAlternateSetting == asnum) { 536 - dev_warn(ddev, "Duplicate descriptor for config %d " 536 + dev_notice(ddev, "Duplicate descriptor for config %d " 537 537 "interface %d altsetting %d, skipping\n", 538 538 cfgno, inum, asnum); 539 539 goto skip_to_next_interface_descriptor; ··· 559 559 num_ep = num_ep_orig = alt->desc.bNumEndpoints; 560 560 alt->desc.bNumEndpoints = 0; /* Use as a counter */ 561 561 if (num_ep > USB_MAXENDPOINTS) { 562 - dev_warn(ddev, "too many endpoints for config %d interface %d " 562 + dev_notice(ddev, "too many endpoints for config %d interface %d " 563 563 "altsetting %d: %d, using maximum allowed: %d\n", 564 564 cfgno, inum, asnum, num_ep, USB_MAXENDPOINTS); 565 565 num_ep = USB_MAXENDPOINTS; ··· 590 590 } 591 591 592 592 if (n != num_ep_orig) 593 - dev_warn(ddev, "config %d interface %d altsetting %d has %d " 593 + dev_notice(ddev, "config %d interface %d altsetting %d has %d " 594 594 "endpoint descriptor%s, different from the interface " 595 595 "descriptor's value: %d\n", 596 596 cfgno, inum, asnum, n, plural(n), num_ep_orig); ··· 625 625 if (config->desc.bDescriptorType != USB_DT_CONFIG || 626 626 config->desc.bLength < USB_DT_CONFIG_SIZE || 627 627 config->desc.bLength > size) { 628 - dev_err(ddev, "invalid descriptor for config index %d: " 628 + dev_notice(ddev, "invalid descriptor for config index %d: " 629 629 "type = 0x%X, length = %d\n", cfgidx, 630 630 config->desc.bDescriptorType, config->desc.bLength); 631 631 return -EINVAL; ··· 636 636 size -= config->desc.bLength; 637 637 638 638 if (nintf > USB_MAXINTERFACES) { 639 - dev_warn(ddev, "config %d has too many interfaces: %d, " 639 + dev_notice(ddev, "config %d has too many interfaces: %d, " 640 640 "using maximum allowed: %d\n", 641 641 cfgno, nintf, USB_MAXINTERFACES); 642 642 nintf = USB_MAXINTERFACES; ··· 650 650 (buffer2 += header->bLength, size2 -= header->bLength)) { 651 651 652 652 if (size2 < sizeof(struct usb_descriptor_header)) { 653 - dev_warn(ddev, "config %d descriptor has %d excess " 653 + dev_notice(ddev, "config %d descriptor has %d excess " 654 654 "byte%s, ignoring\n", 655 655 cfgno, size2, plural(size2)); 656 656 break; ··· 658 658 659 659 header = (struct usb_descriptor_header *) buffer2; 660 660 if ((header->bLength > size2) || (header->bLength < 2)) { 661 - dev_warn(ddev, "config %d has an invalid descriptor " 661 + dev_notice(ddev, "config %d has an invalid descriptor " 662 662 "of length %d, skipping remainder of the config\n", 663 663 cfgno, header->bLength); 664 664 break; ··· 670 670 671 671 d = (struct usb_interface_descriptor *) header; 672 672 if (d->bLength < USB_DT_INTERFACE_SIZE) { 673 - dev_warn(ddev, "config %d has an invalid " 673 + dev_notice(ddev, "config %d has an invalid " 674 674 "interface descriptor of length %d, " 675 675 "skipping\n", cfgno, d->bLength); 676 676 continue; ··· 680 680 681 681 if ((dev->quirks & USB_QUIRK_HONOR_BNUMINTERFACES) && 682 682 n >= nintf_orig) { 683 - dev_warn(ddev, "config %d has more interface " 683 + dev_notice(ddev, "config %d has more interface " 684 684 "descriptors, than it declares in " 685 685 "bNumInterfaces, ignoring interface " 686 686 "number: %d\n", cfgno, inum); ··· 688 688 } 689 689 690 690 if (inum >= nintf_orig) 691 - dev_warn(ddev, "config %d has an invalid " 691 + dev_notice(ddev, "config %d has an invalid " 692 692 "interface number: %d but max is %d\n", 693 693 cfgno, inum, nintf_orig - 1); 694 694 ··· 713 713 714 714 d = (struct usb_interface_assoc_descriptor *)header; 715 715 if (d->bLength < USB_DT_INTERFACE_ASSOCIATION_SIZE) { 716 - dev_warn(ddev, 716 + dev_notice(ddev, 717 717 "config %d has an invalid interface association descriptor of length %d, skipping\n", 718 718 cfgno, d->bLength); 719 719 continue; 720 720 } 721 721 722 722 if (iad_num == USB_MAXIADS) { 723 - dev_warn(ddev, "found more Interface " 723 + dev_notice(ddev, "found more Interface " 724 724 "Association Descriptors " 725 725 "than allocated for in " 726 726 "configuration %d\n", cfgno); ··· 731 731 732 732 } else if (header->bDescriptorType == USB_DT_DEVICE || 733 733 header->bDescriptorType == USB_DT_CONFIG) 734 - dev_warn(ddev, "config %d contains an unexpected " 734 + dev_notice(ddev, "config %d contains an unexpected " 735 735 "descriptor of type 0x%X, skipping\n", 736 736 cfgno, header->bDescriptorType); 737 737 ··· 740 740 config->desc.wTotalLength = cpu_to_le16(buffer2 - buffer0); 741 741 742 742 if (n != nintf) 743 - dev_warn(ddev, "config %d has %d interface%s, different from " 743 + dev_notice(ddev, "config %d has %d interface%s, different from " 744 744 "the descriptor's value: %d\n", 745 745 cfgno, n, plural(n), nintf_orig); 746 746 else if (n == 0) 747 - dev_warn(ddev, "config %d has no interfaces?\n", cfgno); 747 + dev_notice(ddev, "config %d has no interfaces?\n", cfgno); 748 748 config->desc.bNumInterfaces = nintf = n; 749 749 750 750 /* Check for missing interface numbers */ ··· 754 754 break; 755 755 } 756 756 if (j >= nintf) 757 - dev_warn(ddev, "config %d has no interface number " 757 + dev_notice(ddev, "config %d has no interface number " 758 758 "%d\n", cfgno, i); 759 759 } 760 760 ··· 762 762 for (i = 0; i < nintf; ++i) { 763 763 j = nalts[i]; 764 764 if (j > USB_MAXALTSETTING) { 765 - dev_warn(ddev, "too many alternate settings for " 765 + dev_notice(ddev, "too many alternate settings for " 766 766 "config %d interface %d: %d, " 767 767 "using maximum allowed: %d\n", 768 768 cfgno, inums[i], j, USB_MAXALTSETTING); ··· 811 811 break; 812 812 } 813 813 if (n >= intfc->num_altsetting) 814 - dev_warn(ddev, "config %d interface %d has no " 814 + dev_notice(ddev, "config %d interface %d has no " 815 815 "altsetting %d\n", cfgno, inums[i], j); 816 816 } 817 817 } ··· 868 868 int result; 869 869 870 870 if (ncfg > USB_MAXCONFIG) { 871 - dev_warn(ddev, "too many configurations: %d, " 871 + dev_notice(ddev, "too many configurations: %d, " 872 872 "using maximum allowed: %d\n", ncfg, USB_MAXCONFIG); 873 873 dev->descriptor.bNumConfigurations = ncfg = USB_MAXCONFIG; 874 874 } ··· 902 902 "descriptor/%s: %d\n", cfgno, "start", result); 903 903 if (result != -EPIPE) 904 904 goto err; 905 - dev_err(ddev, "chopping to %d config(s)\n", cfgno); 905 + dev_notice(ddev, "chopping to %d config(s)\n", cfgno); 906 906 dev->descriptor.bNumConfigurations = cfgno; 907 907 break; 908 908 } else if (result < 4) { ··· 934 934 goto err; 935 935 } 936 936 if (result < length) { 937 - dev_warn(ddev, "config index %d descriptor too short " 937 + dev_notice(ddev, "config index %d descriptor too short " 938 938 "(expected %i, got %i)\n", cfgno, length, result); 939 939 length = result; 940 940 } ··· 993 993 /* Get BOS descriptor */ 994 994 ret = usb_get_descriptor(dev, USB_DT_BOS, 0, bos, USB_DT_BOS_SIZE); 995 995 if (ret < USB_DT_BOS_SIZE || bos->bLength < USB_DT_BOS_SIZE) { 996 - dev_err(ddev, "unable to get BOS descriptor or descriptor too short\n"); 996 + dev_notice(ddev, "unable to get BOS descriptor or descriptor too short\n"); 997 997 if (ret >= 0) 998 998 ret = -ENOMSG; 999 999 kfree(bos); ··· 1021 1021 1022 1022 ret = usb_get_descriptor(dev, USB_DT_BOS, 0, buffer, total_len); 1023 1023 if (ret < total_len) { 1024 - dev_err(ddev, "unable to get BOS descriptor set\n"); 1024 + dev_notice(ddev, "unable to get BOS descriptor set\n"); 1025 1025 if (ret >= 0) 1026 1026 ret = -ENOMSG; 1027 1027 goto err; ··· 1046 1046 } 1047 1047 1048 1048 if (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) { 1049 - dev_warn(ddev, "descriptor type invalid, skip\n"); 1049 + dev_notice(ddev, "descriptor type invalid, skip\n"); 1050 1050 continue; 1051 1051 } 1052 1052