USB: replace 0 with NULL for pointers.

Found with devel/coccinelle.

Reviewed by:	hselasky
This commit is contained in:
Pedro F. Giffuni 2016-04-09 20:36:07 +00:00
parent eaee150e3f
commit 2bf493863f
5 changed files with 8 additions and 8 deletions

@ -139,8 +139,8 @@ libusb20_tr_close(struct libusb20_transfer *xfer)
free(xfer->ppBuffer); free(xfer->ppBuffer);
} }
/* reset variable fields in case the transfer is opened again */ /* reset variable fields in case the transfer is opened again */
xfer->priv_sc0 = 0; xfer->priv_sc0 = NULL;
xfer->priv_sc1 = 0; xfer->priv_sc1 = NULL;
xfer->is_opened = 0; xfer->is_opened = 0;
xfer->is_pending = 0; xfer->is_pending = 0;
xfer->is_cancel = 0; xfer->is_cancel = 0;

@ -159,7 +159,7 @@ hid_use_report_desc(unsigned char *data, unsigned int size)
report_desc_t r; report_desc_t r;
r = malloc(sizeof(*r) + size); r = malloc(sizeof(*r) + size);
if (r == 0) { if (r == NULL) {
errno = ENOMEM; errno = ENOMEM;
return (NULL); return (NULL);
} }

@ -77,9 +77,9 @@ hid_init(const char *hidname)
char line[100], name[100], *p, *n; char line[100], name[100], *p, *n;
int no; int no;
int lineno; int lineno;
struct usage_page *curpage = 0; struct usage_page *curpage = NULL;
if (hidname == 0) if (hidname == NULL)
hidname = _PATH_HIDTABLE; hidname = _PATH_HIDTABLE;
f = fopen(hidname, "r"); f = fopen(hidname, "r");
@ -124,7 +124,7 @@ hid_init(const char *hidname)
curpage->pagesize++; curpage->pagesize++;
} else { } else {
if (npages >= npagesmax) { if (npages >= npagesmax) {
if (pages == 0) { if (pages == NULL) {
npagesmax = 5; npagesmax = 5;
pages = malloc(npagesmax * pages = malloc(npagesmax *
sizeof (struct usage_page)); sizeof (struct usage_page));

@ -235,7 +235,7 @@ urndis_attach(device_t dev)
cmd = usbd_find_descriptor(uaa->device, NULL, uaa->info.bIfaceIndex, cmd = usbd_find_descriptor(uaa->device, NULL, uaa->info.bIfaceIndex,
UDESC_CS_INTERFACE, 0xFF, UDESCSUB_CDC_CM, 0xFF); UDESC_CS_INTERFACE, 0xFF, UDESCSUB_CDC_CM, 0xFF);
if (cmd != 0) { if (cmd != NULL) {
DPRINTF("Call Mode Descriptor found, dataif=%d\n", cmd->bDataInterface); DPRINTF("Call Mode Descriptor found, dataif=%d\n", cmd->bDataInterface);
iface_index[0] = cmd->bDataInterface; iface_index[0] = cmd->bDataInterface;
} }

@ -925,7 +925,7 @@ usbd_transfer_setup(struct usb_device *udev,
DPRINTFN(6, "setup array has zero length!\n"); DPRINTFN(6, "setup array has zero length!\n");
return (USB_ERR_INVAL); return (USB_ERR_INVAL);
} }
if (ifaces == 0) { if (ifaces == NULL) {
DPRINTFN(6, "ifaces array is NULL!\n"); DPRINTFN(6, "ifaces array is NULL!\n");
return (USB_ERR_INVAL); return (USB_ERR_INVAL);
} }