Re: [PATCH 1/6] usb: gadget: net2280: fix sparse warnings

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

 



Hi,

On Fri, Mar 22, 2013 at 09:59:11PM +0300, Sergei Shtylyov wrote:
> >>>>>fix the following sparse warnings:
> >>>>>drivers/usb/gadget/net2280.c:2063:13: warning: Using plain integer as NULL pointer
> >>>>>drivers/usb/gadget/net2280.c:2321:68: warning: Using plain integer as NULL pointer
> >>>>>drivers/usb/gadget/net2280.c:2349:68: warning: Using plain integer as NULL pointer
> >>>>>drivers/usb/gadget/net2280.c:2371:68: warning: Using plain integer as NULL pointer
> >>>>>Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> >>>>>---
> >>>>>  drivers/usb/gadget/net2280.c | 8 ++++----
> >>>>>  1 file changed, 4 insertions(+), 4 deletions(-)
> >>>>>diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
> >>>>>index 691cc65..e869188 100644
> >>>>>--- a/drivers/usb/gadget/net2280.c
> >>>>>+++ b/drivers/usb/gadget/net2280.c
> >>>>>@@ -2060,7 +2060,7 @@ static void handle_ep_small (struct net2280_ep *ep)
> >>>>>  		return;
> >>>>>
> >>>>>  	/* manual DMA queue advance after short OUT */
> >>>>>-	if (likely (ep->dma != 0)) {
> >>>>>+	if (likely (ep->dma)) {
> >>>>>  		if (t & (1 << SHORT_PACKET_TRANSFERRED_INTERRUPT)) {
> >>>>>  			u32	count;
> >>>>>  			int	stopped = ep->stopped;
> >>>>>@@ -2318,7 +2318,7 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat)
> >>>>>  			/* hw handles device and interface status */
> >>>>>  			if (u.r.bRequestType != (USB_DIR_IN|USB_RECIP_ENDPOINT))
> >>>>>  				goto delegate;
> >>>>>-			if ((e = get_ep_by_addr (dev, w_index)) == 0
> >>>>>+			if ((e = get_ep_by_addr (dev, w_index)) == NULL
> >>>>>  					|| w_length > 2)
> >>>>>  				goto do_stall;
> >>>>>
> >>>>>@@ -2346,7 +2346,7 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat)
> >>>>>  			if (w_value != USB_ENDPOINT_HALT
> >>>>>  					|| w_length != 0)
> >>>>>  				goto do_stall;
> >>>>>-			if ((e = get_ep_by_addr (dev, w_index)) == 0)
> >>>>>+			if ((e = get_ep_by_addr (dev, w_index)) == NULL)
> >>>>>  				goto do_stall;
> >>>>>  			if (e->wedged) {
> >>>>>  				VDEBUG(dev, "%s wedged, halt not cleared\n",
> >>>>>@@ -2368,7 +2368,7 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat)
> >>>>>  			if (w_value != USB_ENDPOINT_HALT
> >>>>>  					|| w_length != 0)
> >>>>>  				goto do_stall;
> >>>>>-			if ((e = get_ep_by_addr (dev, w_index)) == 0)
> >>>>>+			if ((e = get_ep_by_addr (dev, w_index)) == NULL)
> >>>>>  				goto do_stall;
> >>>>>  			if (e->ep.name == ep0name)
> >>>>>  				goto do_stall;
> >>>>    Did you run the patch thru checkpatch.pl or did you intentionally
> >>>>leave spaces between function/macro names and (?
> >>>patch was written to fix the sparse warning, not the checkpatch errors
> >>>which are all over this driver. Fixing one instance alone would make no
> >>>difference.
> >>     However, isn't there a formal requirement that a patch doesn't cause
> >>  checkpatch.pl to complain?
> >this patch didn't cause checkpatch.pl to complain. Run checkpatch.pl on
> >the file and you'll see the complaint is already there
> 
>    I understand you didn't introduce them, however:
> 
> [headless@wasted renesas]$ scripts/checkpatch.pl
> ~/patches/usb-gadget-net2280-fix-sparse-warnings.patch
> WARNING: space prohibited between function name and open parenthesis '('
> #22: FILE: drivers/usb/gadget/net2280.c:2063:
> +    if (likely (ep->dma)) {
> 
> WARNING: space prohibited between function name and open parenthesis '('
> #31: FILE: drivers/usb/gadget/net2280.c:2321:
> +            if ((e = get_ep_by_addr (dev, w_index)) == NULL
> 
> ERROR: do not use assignment in if condition
> #31: FILE: drivers/usb/gadget/net2280.c:2321:
> +            if ((e = get_ep_by_addr (dev, w_index)) == NULL
> 
> WARNING: space prohibited between function name and open parenthesis '('
> #40: FILE: drivers/usb/gadget/net2280.c:2349:
> +            if ((e = get_ep_by_addr (dev, w_index)) == NULL)
> 
> ERROR: do not use assignment in if condition
> #40: FILE: drivers/usb/gadget/net2280.c:2349:
> +            if ((e = get_ep_by_addr (dev, w_index)) == NULL)
> 
> WARNING: space prohibited between function name and open parenthesis '('
> #49: FILE: drivers/usb/gadget/net2280.c:2371:
> +            if ((e = get_ep_by_addr (dev, w_index)) == NULL)
> 
> ERROR: do not use assignment in if condition
> #49: FILE: drivers/usb/gadget/net2280.c:2371:
> +            if ((e = get_ep_by_addr (dev, w_index)) == NULL)
> 
> total: 3 errors, 4 warnings, 32 lines checked
> 
> /home/headless/patches/usb-gadget-net2280-fix-sparse-warnings.patch
> has style problems, please review.
> 
> If any of these errors are false positives, please report
> them to the maintainer, see CHECKPATCH in MAINTAINERS.
>    Now, if this patch seems acceptable, sorry for the noise and pedantry.

none of them are false positives, just that they're not introduced by
$SUBJECT and $SUBJECT is not trying to make checkpatch.pl happier in any
way. That's all up to another patch.

-- 
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