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

USB: OHCI: fix new compiler warnings

This patch (as1515) fixes some unavoidably dumb compiler warnings:

CC [M] drivers/usb/renesas_usbhs/mod.o
In file included from drivers/usb/host/ohci-hcd.c:101:0:
drivers/usb/host/ohci-dbg.c: In function ‘fill_registers_buffer’:
drivers/usb/host/ohci-dbg.c:656:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘next’ will never be NULL [-Waddress]
drivers/usb/host/ohci-dbg.c:675:3: warning: the comparison will always evaluate as ‘true’ for the address of ‘next’ will never be NULL [-Waddress]

Instead of trying to fix the macro to work under all cirumstances,
just add a second macro for use in cases where the "next" argument is
the address of a local variable.

Unfortunately the macro cannot be replaced by a real subroutine,
because there's no va_list version of ohci_dbg() or dev_dbg().

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Alan Stern and committed by
Greg Kroah-Hartman
194b3af4 3297f86a

+10 -2
+10 -2
drivers/usb/host/ohci-dbg.c
··· 82 82 ohci_dbg(ohci,format, ## arg ); \ 83 83 } while (0); 84 84 85 + /* Version for use where "next" is the address of a local variable */ 86 + #define ohci_dbg_nosw(ohci, next, size, format, arg...) \ 87 + do { \ 88 + unsigned s_len; \ 89 + s_len = scnprintf(*next, *size, format, ## arg); \ 90 + *size -= s_len; *next += s_len; \ 91 + } while (0); 92 + 85 93 86 94 static void ohci_dump_intr_mask ( 87 95 struct ohci_hcd *ohci, ··· 661 653 662 654 /* dump driver info, then registers in spec order */ 663 655 664 - ohci_dbg_sw (ohci, &next, &size, 656 + ohci_dbg_nosw(ohci, &next, &size, 665 657 "bus %s, device %s\n" 666 658 "%s\n" 667 659 "%s\n", ··· 680 672 681 673 /* hcca */ 682 674 if (ohci->hcca) 683 - ohci_dbg_sw (ohci, &next, &size, 675 + ohci_dbg_nosw(ohci, &next, &size, 684 676 "hcca frame 0x%04x\n", ohci_frame_no(ohci)); 685 677 686 678 /* other registers mostly affect frame timings */