0 -> NULL, drivers/usb/gadget/
Subsystems (3)
PATCH 1/1 0 -> NULL, drivers/usb/gadget/
When comparing a pointer, it's clearer to compare it to NULL than to 0.
Here is the semantic patch:
@@
expression *E;
@@
E =
- 0
+ NULL
@@
expression *E;
@@
- 0
+ NULL
= E
@@
expression *E;
@@
E !- 0
+ NULL
@@
expression *E;
@@
- 0
+ NULL
!= E
PS: I have performed the same transformation on the whole kernel and it affects around 300 files. I will send the remaining patches if you are interested in.
Signed-off-by Yoann Padioleau <[email protected]>
config.c | 2 +- ether.c | 2 +- goku_udc.c | 2 +- inode.c | 2 +- lh7a40x_udc.c | 2 +- m66592-udc.c | 2 +- net2280.c | 8 ++++---- pxa2xx_udc.c | 4 ++-- pxa2xx_udc.h | 2 +- s3c2410_udc.c | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-)
drivers/usb/gadget/config.c +1 -1
@@ -50,7 +50,7 @@ usb_descriptor_fillbuf(void *buf, unsignreturn -EINVAL ;/* fill buffer from src[] until null descriptor ptr */ -for (;0 != *src; src++) { +for (;NULL != *src; src++) {unsigned len = (*src)->bLength;if (len > buflen)
drivers/usb/gadget/ether.c +1 -1
@@ -1719,7 +1719,7 @@ rx_submit (struct eth_dev *dev, struct u size +=sizeof (struct rndis_packet_msg_type ); size -= size % dev->out_ep->maxpacket; -if ((skb =alloc_skb (size +NET_IP_ALIGN , gfp_flags)) =0 ) { +if ((skb =alloc_skb (size +NET_IP_ALIGN , gfp_flags)) =NULL ) {DEBUG (dev,"no rx skb\n" ); goto enomem; }
drivers/usb/gadget/goku_udc.c +1 -1
@@ -776,7 +776,7 @@ #endif }/* else pio or dma irq handler advances the queue. */ -if (likely (req !=0 )) +if (likely (req !=NULL ))list_add_tail (&req->queue, &ep->queue); if (likely(!list_empty(&ep->queue))
drivers/usb/gadget/inode.c +1 -1
@@ -1394,7 +1394,7 @@ gadgetfs_setup (struct usb_gadget *gadge dev->setup_abort =0 ;if (dev->state =STATE_DEV_UNCONNECTED ) {#ifdef CONFIG_USB_GADGET_DUALSPEED -if (gadget->speed =USB_SPEED_HIGH && dev->hs_config =0 ) { +if (gadget->speed =USB_SPEED_HIGH && dev->hs_config =NULL ) {spin_unlock (&dev->lock);ERROR (dev,"no high speed config??\n" );return -EINVAL ;
drivers/usb/gadget/lh7a40x_udc.c +1 -1
@@ -1202,7 +1202,7 @@ static int lh7a40x_queue(struct usb_ep * }/* pio or dma irq handler advances the queue. */ -if (likely (req !=0 )) +if (likely (req !=NULL ))list_add_tail (&req->queue, &ep->queue);spin_unlock_irqrestore (&dev->lock, flags);
drivers/usb/gadget/m66592-udc.c +1 -1
@@ -1278,7 +1278,7 @@ static int m66592_queue(struct usb_ep *_ req->req.actual =0 ; req->req.status = -EINPROGRESS ; -if (ep->desc =0 )/* control */ +if (ep->desc =NULL )/* control */ start_ep0 (ep, req);else {if (request && !ep->busy)
drivers/usb/gadget/net2280.c +4 -4
@@ -2120,7 +2120,7 @@ #endifreturn ;/* manual DMA queue advance after short OUT */ -if (likely (ep->dma !=0 )) { +if (likely (ep->dma !=NULL )) {if (t & (1 <<SHORT_PACKET_TRANSFERRED_INTERRUPT )) {u32 count;int stopped = ep->stopped;
@@ -2380,7 +2380,7 @@ #define w_length le16_to_cpu(u.r.wLength/* 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;
@@ -2408,7 +2408,7 @@ #define w_length le16_to_cpu(u.r.wLengthif (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;clear_halt (e);allow_status (ep);
@@ -2425,7 +2425,7 @@ #define w_length le16_to_cpu(u.r.wLengthif (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;set_halt (e);allow_status (ep);
drivers/usb/gadget/pxa2xx_udc.c +2 -2
@@ -688,7 +688,7 @@ pxa2xx_ep_queue(struct usb_ep *_ep, stru/* kickstart this i/o queue? */ if (list_empty (&ep->queue) && !ep->stopped) { -if (ep->desc =0 /* ep0 */ ) { +if (ep->desc =NULL /* ep0 */ ) {unsigned length = _req->length;switch (dev->ep0state) {
@@ -742,7 +742,7 @@ pxa2xx_ep_queue(struct usb_ep *_ep, stru }/* pio or dma irq handler advances the queue. */ -if (likely (req !=0 )) +if (likely (req !=NULL ))list_add_tail (&req->queue, &ep->queue);local_irq_restore (flags);
drivers/usb/gadget/pxa2xx_udc.h +1 -1
@@ -232,7 +232,7 @@ dump_state(struct pxa2xx_udc *dev) dev->stats.read.bytes, dev->stats.read.ops);for (i =1 ; i <PXA_UDC_NUM_ENDPOINTS ; i++) { -if (dev->ep [i].desc =0 ) +if (dev->ep [i].desc =NULL )continue ;DMSG ("udccs%d = %02x\n" , i, *dev->ep->reg_udccs); }
drivers/usb/gadget/s3c2410_udc.c +1 -1
@@ -1294,7 +1294,7 @@ static int s3c2410_udc_queue(struct usb_ }/* pio or dma irq handler advances the queue. */ -if (likely (req !=0 )) +if (likely (req !=NULL ))list_add_tail (&req->queue, &ep->queue);local_irq_restore (flags);
Quoted 4 lines · Yoann Padioleau
PS: I have performed the same transformation on the whole kernel and it affects around 300 files. I will send the remaining patches if you are interested in.
Don't hold off :)
Jan