Re: [PATCH 1/2] usb: host: ohci: fix compile warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 10, 2011 at 10:47:12AM +0200, Felipe Balbi wrote:
> Fix the following compile warning:
> 
> | 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:642: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:661:3: warning: the comparison will \
> |	always evaluate as ‘true’ for the address of ‘next’ will \
> |	never be NULL [-Waddress]
> 
> Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> ---
>  drivers/usb/host/ohci-dbg.c |    3 ---
>  1 files changed, 0 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
> index d7d3449..aa1270a 100644
> --- a/drivers/usb/host/ohci-dbg.c
> +++ b/drivers/usb/host/ohci-dbg.c
> @@ -74,12 +74,9 @@ urb_print(struct urb * urb, char * str, int small, int status)
>  
>  #define ohci_dbg_sw(ohci, next, size, format, arg...) \
>  	do { \
> -	if (next != NULL) { \
>  		unsigned s_len; \
>  		s_len = scnprintf (*next, *size, format, ## arg ); \
>  		*size -= s_len; *next += s_len; \
> -	} else \
> -		ohci_dbg(ohci,format, ## arg ); \
>  	} while (0);

I didn't look very deep, but another solution would be the one below:

diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index d7d3449..5433010 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -639,7 +639,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
 
 	/* dump driver info, then registers in spec order */
 
-	ohci_dbg_sw (ohci, &next, &size,
+	ohci_dbg_sw (ohci, next, &size,
 		"bus %s, device %s\n"
 		"%s\n"
 		"%s\n",
@@ -658,7 +658,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
 
 	/* hcca */
 	if (ohci->hcca)
-		ohci_dbg_sw (ohci, &next, &size,
+		ohci_dbg_sw (ohci, next, &size,
 			"hcca frame 0x%04x\n", ohci_frame_no(ohci));
 
 	/* other registers mostly affect frame timings */

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux