Author: pfg Date: Sat Apr 9 20:36:07 2016 New Revision: 297764 URL: https://svnweb.freebsd.org/changeset/base/297764
Log: USB: replace 0 with NULL for pointers. Found with devel/coccinelle. Reviewed by: hselasky Modified: head/lib/libusb/libusb20.c head/lib/libusbhid/descr.c head/lib/libusbhid/usage.c head/sys/dev/usb/net/if_urndis.c head/sys/dev/usb/usb_transfer.c Modified: head/lib/libusb/libusb20.c ============================================================================== --- head/lib/libusb/libusb20.c Sat Apr 9 20:30:50 2016 (r297763) +++ head/lib/libusb/libusb20.c Sat Apr 9 20:36:07 2016 (r297764) @@ -139,8 +139,8 @@ libusb20_tr_close(struct libusb20_transf free(xfer->ppBuffer); } /* reset variable fields in case the transfer is opened again */ - xfer->priv_sc0 = 0; - xfer->priv_sc1 = 0; + xfer->priv_sc0 = NULL; + xfer->priv_sc1 = NULL; xfer->is_opened = 0; xfer->is_pending = 0; xfer->is_cancel = 0; Modified: head/lib/libusbhid/descr.c ============================================================================== --- head/lib/libusbhid/descr.c Sat Apr 9 20:30:50 2016 (r297763) +++ head/lib/libusbhid/descr.c Sat Apr 9 20:36:07 2016 (r297764) @@ -159,7 +159,7 @@ hid_use_report_desc(unsigned char *data, report_desc_t r; r = malloc(sizeof(*r) + size); - if (r == 0) { + if (r == NULL) { errno = ENOMEM; return (NULL); } Modified: head/lib/libusbhid/usage.c ============================================================================== --- head/lib/libusbhid/usage.c Sat Apr 9 20:30:50 2016 (r297763) +++ head/lib/libusbhid/usage.c Sat Apr 9 20:36:07 2016 (r297764) @@ -77,9 +77,9 @@ hid_init(const char *hidname) char line[100], name[100], *p, *n; int no; int lineno; - struct usage_page *curpage = 0; + struct usage_page *curpage = NULL; - if (hidname == 0) + if (hidname == NULL) hidname = _PATH_HIDTABLE; f = fopen(hidname, "r"); @@ -124,7 +124,7 @@ hid_init(const char *hidname) curpage->pagesize++; } else { if (npages >= npagesmax) { - if (pages == 0) { + if (pages == NULL) { npagesmax = 5; pages = malloc(npagesmax * sizeof (struct usage_page)); Modified: head/sys/dev/usb/net/if_urndis.c ============================================================================== --- head/sys/dev/usb/net/if_urndis.c Sat Apr 9 20:30:50 2016 (r297763) +++ head/sys/dev/usb/net/if_urndis.c Sat Apr 9 20:36:07 2016 (r297764) @@ -235,7 +235,7 @@ urndis_attach(device_t dev) cmd = usbd_find_descriptor(uaa->device, NULL, uaa->info.bIfaceIndex, UDESC_CS_INTERFACE, 0xFF, UDESCSUB_CDC_CM, 0xFF); - if (cmd != 0) { + if (cmd != NULL) { DPRINTF("Call Mode Descriptor found, dataif=%d\n", cmd->bDataInterface); iface_index[0] = cmd->bDataInterface; } Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Sat Apr 9 20:30:50 2016 (r297763) +++ head/sys/dev/usb/usb_transfer.c Sat Apr 9 20:36:07 2016 (r297764) @@ -925,7 +925,7 @@ usbd_transfer_setup(struct usb_device *u DPRINTFN(6, "setup array has zero length!\n"); return (USB_ERR_INVAL); } - if (ifaces == 0) { + if (ifaces == NULL) { DPRINTFN(6, "ifaces array is NULL!\n"); return (USB_ERR_INVAL); } _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"