From 2bf493863feef6ec0033f3f18d8abcb0a105d963 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Sat, 9 Apr 2016 20:36:07 +0000 Subject: [PATCH] USB: replace 0 with NULL for pointers. Found with devel/coccinelle. Reviewed by: hselasky --- lib/libusb/libusb20.c | 4 ++-- lib/libusbhid/descr.c | 2 +- lib/libusbhid/usage.c | 6 +++--- sys/dev/usb/net/if_urndis.c | 2 +- sys/dev/usb/usb_transfer.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libusb/libusb20.c b/lib/libusb/libusb20.c index 1de3a265125a..2eb75f1c6d7c 100644 --- a/lib/libusb/libusb20.c +++ b/lib/libusb/libusb20.c @@ -139,8 +139,8 @@ libusb20_tr_close(struct libusb20_transfer *xfer) 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; diff --git a/lib/libusbhid/descr.c b/lib/libusbhid/descr.c index 0c6634236635..4ca9dd795d09 100644 --- a/lib/libusbhid/descr.c +++ b/lib/libusbhid/descr.c @@ -159,7 +159,7 @@ hid_use_report_desc(unsigned char *data, unsigned int size) report_desc_t r; r = malloc(sizeof(*r) + size); - if (r == 0) { + if (r == NULL) { errno = ENOMEM; return (NULL); } diff --git a/lib/libusbhid/usage.c b/lib/libusbhid/usage.c index eeff818afed8..3960dad8076a 100644 --- a/lib/libusbhid/usage.c +++ b/lib/libusbhid/usage.c @@ -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)); diff --git a/sys/dev/usb/net/if_urndis.c b/sys/dev/usb/net/if_urndis.c index 749f874c0d94..de7fd1e4b335 100644 --- a/sys/dev/usb/net/if_urndis.c +++ b/sys/dev/usb/net/if_urndis.c @@ -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; } diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c index 783a96c017b2..17b9367df4b7 100644 --- a/sys/dev/usb/usb_transfer.c +++ b/sys/dev/usb/usb_transfer.c @@ -925,7 +925,7 @@ usbd_transfer_setup(struct usb_device *udev, 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); }