staging/ozwpan: Fix NULL vs zero in ozhcd.c (sparse warning)
authorPeter Huewe <peterhuewe@gmx.de>
Fri, 15 Feb 2013 14:22:28 +0000 (15:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Feb 2013 18:25:11 +0000 (10:25 -0800)
This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

If the initialization with NULL was unnecessary (due to unconditional
assignment before first use) it was removed.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ozwpan/ozhcd.c

index 9154f33..b48663e 100644 (file)
@@ -248,7 +248,7 @@ static int oz_get_port_from_addr(struct oz_hcd *ozhcd, u8 bus_addr)
  */
 static struct oz_urb_link *oz_alloc_urb_link(void)
 {
-       struct oz_urb_link *urbl = 0;
+       struct oz_urb_link *urbl = NULL;
        unsigned long irq_state;
        spin_lock_irqsave(&g_link_lock, irq_state);
        if (g_link_pool) {
@@ -257,7 +257,7 @@ static struct oz_urb_link *oz_alloc_urb_link(void)
                --g_link_pool_size;
        }
        spin_unlock_irqrestore(&g_link_lock, irq_state);
-       if (urbl == 0)
+       if (urbl == NULL)
                urbl = kmalloc(sizeof(struct oz_urb_link), GFP_ATOMIC);
        return urbl;
 }
@@ -274,7 +274,7 @@ static void oz_free_urb_link(struct oz_urb_link *urbl)
                if (g_link_pool_size < OZ_MAX_LINK_POOL_SIZE) {
                        urbl->link.next = g_link_pool;
                        g_link_pool = &urbl->link;
-                       urbl = 0;
+                       urbl = NULL;
                        g_link_pool_size++;
                }
                spin_unlock_irqrestore(&g_link_lock, irq_state);
@@ -291,7 +291,7 @@ static void oz_empty_link_pool(void)
        unsigned long irq_state;
        spin_lock_irqsave(&g_link_lock, irq_state);
        e = g_link_pool;
-       g_link_pool = 0;
+       g_link_pool = NULL;
        g_link_pool_size = 0;
        spin_unlock_irqrestore(&g_link_lock, irq_state);
        while (e) {
@@ -337,7 +337,7 @@ struct oz_urb_link *oz_uncancel_urb(struct oz_hcd *ozhcd, struct urb *urb)
                        return urbl;
                }
        }
-       return 0;
+       return NULL;
 }
 /*------------------------------------------------------------------------------
  * This is called when we have finished processing an urb. It unlinks it from
@@ -349,13 +349,13 @@ static void oz_complete_urb(struct usb_hcd *hcd, struct urb *urb,
 {
        struct oz_hcd *ozhcd = oz_hcd_private(hcd);
        unsigned long irq_state;
-       struct oz_urb_link *cancel_urbl = 0;
+       struct oz_urb_link *cancel_urbl = NULL;
        spin_lock_irqsave(&g_tasklet_lock, irq_state);
        usb_hcd_unlink_urb_from_ep(hcd, urb);
        /* Clear hcpriv which will prevent it being put in the cancel list
         * in the event that an attempt is made to cancel it.
         */
-       urb->hcpriv = 0;
+       urb->hcpriv = NULL;
        /* Walk the cancel list in case the urb is already sitting there.
         * Since we process the cancel list in a tasklet rather than in
         * the dequeue function this could happen.
@@ -507,7 +507,7 @@ static int oz_enqueue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
                        ep->last_jiffies = jiffies;
                        ep->credit = 0;
                        oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num,
-                                       0, 0, ep->credit);
+                                       0, NULL, ep->credit);
                }
        } else {
                err = -EPIPE;
@@ -525,7 +525,7 @@ static int oz_enqueue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
 static int oz_dequeue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
                        struct urb *urb)
 {
-       struct oz_urb_link *urbl = 0;
+       struct oz_urb_link *urbl = NULL;
        struct oz_endpoint *ep;
        spin_lock_bh(&port->ozhcd->hcd_lock);
        if (in_dir)
@@ -540,7 +540,7 @@ static int oz_dequeue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
                                list_del_init(e);
                                break;
                        }
-                       urbl = 0;
+                       urbl = NULL;
                }
        }
        spin_unlock_bh(&port->ozhcd->hcd_lock);
@@ -556,8 +556,8 @@ static struct urb *oz_find_urb_by_id(struct oz_port *port, int ep_ix,
                u8 req_id)
 {
        struct oz_hcd *ozhcd = port->ozhcd;
-       struct urb *urb = 0;
-       struct oz_urb_link *urbl = 0;
+       struct urb *urb = NULL;
+       struct oz_urb_link *urbl = NULL;
        struct oz_endpoint *ep;
 
        spin_lock_bh(&ozhcd->hcd_lock);
@@ -630,13 +630,13 @@ static inline void oz_hcd_put(struct oz_hcd *ozhcd)
 void *oz_hcd_pd_arrived(void *hpd)
 {
        int i;
-       void *hport = 0;
-       struct oz_hcd *ozhcd = 0;
+       void *hport = NULL;
+       struct oz_hcd *ozhcd = NULL;
        struct oz_endpoint *ep;
        oz_trace("oz_hcd_pd_arrived()\n");
        ozhcd = oz_hcd_claim();
-       if (ozhcd == 0)
-               return 0;
+       if (ozhcd == NULL)
+               return NULL;
        /* Allocate an endpoint object in advance (before holding hcd lock) to
         * use for out endpoint 0.
         */
@@ -663,7 +663,7 @@ void *oz_hcd_pd_arrived(void *hpd)
                /* Attach out endpoint 0.
                 */
                ozhcd->ports[i].out_ep[0] = ep;
-               ep = 0;
+               ep = NULL;
                hport = &ozhcd->ports[i];
                spin_unlock_bh(&ozhcd->hcd_lock);
                if (ozhcd->flags & OZ_HDC_F_SUSPENDED) {
@@ -676,7 +676,7 @@ void *oz_hcd_pd_arrived(void *hpd)
        }
 out:
        if (ep) /* ep is non-null if not used. */
-               oz_ep_free(0, ep);
+               oz_ep_free(NULL, ep);
        oz_hcd_put(ozhcd);
        return hport;
 }
@@ -691,15 +691,15 @@ void oz_hcd_pd_departed(void *hport)
        struct oz_port *port = (struct oz_port *)hport;
        struct oz_hcd *ozhcd;
        void *hpd;
-       struct oz_endpoint *ep = 0;
+       struct oz_endpoint *ep = NULL;
 
        oz_trace("oz_hcd_pd_departed()\n");
-       if (port == 0) {
+       if (port == NULL) {
                oz_trace("oz_hcd_pd_departed() port = 0\n");
                return;
        }
        ozhcd = port->ozhcd;
-       if (ozhcd == 0)
+       if (ozhcd == NULL)
                return;
        /* Check if this is the connection port - if so clear it.
         */
@@ -717,7 +717,7 @@ void oz_hcd_pd_departed(void *hport)
        oz_clean_endpoints_for_config(ozhcd->hcd, port);
        spin_lock_bh(&port->port_lock);
        hpd = port->hpd;
-       port->hpd = 0;
+       port->hpd = NULL;
        port->bus_addr = 0xff;
        port->flags &= ~(OZ_PORT_F_PRESENT | OZ_PORT_F_DYING);
        port->flags |= OZ_PORT_F_CHANGED;
@@ -728,7 +728,7 @@ void oz_hcd_pd_departed(void *hport)
         */
        if (port->out_ep[0]) {
                ep = port->out_ep[0];
-               port->out_ep[0] = 0;
+               port->out_ep[0] = NULL;
        }
        spin_unlock_bh(&port->port_lock);
        if (ep)
@@ -764,7 +764,7 @@ void oz_hcd_get_desc_cnf(void *hport, u8 req_id, int status, u8 *desc,
        struct urb *urb;
        int err = 0;
 
-       oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, 0, status);
+       oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, NULL, status);
        oz_trace("oz_hcd_get_desc_cnf length = %d offs = %d tot_size = %d\n",
                        length, offset, total_size);
        urb = oz_find_urb_by_id(port, 0, req_id);
@@ -903,7 +903,7 @@ void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, u8 *data,
        unsigned windex;
        unsigned wvalue;
 
-       oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, 0, rcode);
+       oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, NULL, rcode);
        oz_trace("oz_hcd_control_cnf rcode=%u len=%d\n", rcode, data_len);
        urb = oz_find_urb_by_id(port, 0, req_id);
        if (!urb) {
@@ -988,7 +988,7 @@ void oz_hcd_data_ind(void *hport, u8 endpoint, u8 *data, int data_len)
        struct oz_hcd *ozhcd = port->ozhcd;
        spin_lock_bh(&ozhcd->hcd_lock);
        ep = port->in_ep[endpoint & USB_ENDPOINT_NUMBER_MASK];
-       if (ep == 0)
+       if (ep == NULL)
                goto done;
        switch (ep->attrib & USB_ENDPOINT_XFERTYPE_MASK) {
        case USB_ENDPOINT_XFER_INT:
@@ -1056,7 +1056,8 @@ int oz_hcd_heartbeat(void *hport)
                ep->credit += jiffies_to_msecs(now - ep->last_jiffies);
                if (ep->credit > ep->credit_ceiling)
                        ep->credit = ep->credit_ceiling;
-               oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, 0, ep->credit);
+               oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, NULL,
+                            ep->credit);
                ep->last_jiffies = now;
                while (ep->credit && !list_empty(&ep->urb_list)) {
                        urbl = list_first_entry(&ep->urb_list,
@@ -1065,8 +1066,8 @@ int oz_hcd_heartbeat(void *hport)
                        if ((ep->credit + 1) < urb->number_of_packets)
                                break;
                        ep->credit -= urb->number_of_packets;
-                       oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, 0,
-                               ep->credit);
+                       oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, NULL,
+                                    ep->credit);
                        list_move_tail(&urbl->link, &xfr_list);
                }
        }
@@ -1096,17 +1097,17 @@ int oz_hcd_heartbeat(void *hport)
                                ep->credit = 0;
                                oz_event_log(OZ_EVT_EP_CREDIT,
                                        ep->ep_num | USB_DIR_IN,
-                                       0, 0, ep->credit);
+                                       0, NULL, ep->credit);
                                ep->last_jiffies = now;
                                ep->start_frame = 0;
                                oz_event_log(OZ_EVT_EP_BUFFERING,
-                                       ep->ep_num | USB_DIR_IN, 0, 0, 0);
+                                       ep->ep_num | USB_DIR_IN, 0, NULL, 0);
                        }
                        continue;
                }
                ep->credit += jiffies_to_msecs(now - ep->last_jiffies);
                oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num | USB_DIR_IN,
-                       0, 0, ep->credit);
+                       0, NULL, ep->credit);
                ep->last_jiffies = now;
                while (!list_empty(&ep->urb_list)) {
                        struct oz_urb_link *urbl =
@@ -1151,7 +1152,7 @@ int oz_hcd_heartbeat(void *hport)
                        list_move_tail(&urbl->link, &xfr_list);
                        ep->credit -= urb->number_of_packets;
                        oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num | USB_DIR_IN,
-                               0, 0, ep->credit);
+                               0, NULL, ep->credit);
                }
        }
        if (!list_empty(&port->isoc_out_ep) || !list_empty(&port->isoc_in_ep))
@@ -1244,7 +1245,7 @@ static int oz_build_endpoints_for_interface(struct usb_hcd *hcd,
                        if (ep_addr & USB_ENDPOINT_DIR_MASK) {
                                ep->flags |= OZ_F_EP_BUFFERING;
                                oz_event_log(OZ_EVT_EP_BUFFERING,
-                                       ep->ep_num | USB_DIR_IN, 1, 0, 0);
+                                       ep->ep_num | USB_DIR_IN, 1, NULL, 0);
                        } else {
                                ep->flags |= OZ_F_EP_HAVE_STREAM;
                                if (oz_usb_stream_create(port->hpd, ep_num))
@@ -1300,7 +1301,7 @@ static void oz_clean_endpoints_for_interface(struct usb_hcd *hcd,
                 */
                if ((mask & (1<<i)) && port->out_ep[i]) {
                        e = &port->out_ep[i]->link;
-                       port->out_ep[i] = 0;
+                       port->out_ep[i] = NULL;
                        /* Remove from isoc list if present.
                         */
                        list_move_tail(e, &ep_list);
@@ -1309,7 +1310,7 @@ static void oz_clean_endpoints_for_interface(struct usb_hcd *hcd,
                 */
                if ((mask & (1<<(i+OZ_NB_ENDPOINTS))) && port->in_ep[i]) {
                        e = &port->in_ep[i]->link;
-                       port->in_ep[i] = 0;
+                       port->in_ep[i] = NULL;
                        list_move_tail(e, &ep_list);
                }
        }
@@ -1370,7 +1371,7 @@ static void oz_clean_endpoints_for_config(struct usb_hcd *hcd,
        if (port->iface) {
                oz_trace("Freeing interfaces object.\n");
                kfree(port->iface);
-               port->iface = 0;
+               port->iface = NULL;
        }
        port->num_iface = 0;
        spin_unlock_bh(&ozhcd->hcd_lock);
@@ -1380,7 +1381,7 @@ static void oz_clean_endpoints_for_config(struct usb_hcd *hcd,
  */
 static void *oz_claim_hpd(struct oz_port *port)
 {
-       void *hpd = 0;
+       void *hpd = NULL;
        struct oz_hcd *ozhcd = port->ozhcd;
        spin_lock_bh(&ozhcd->hcd_lock);
        hpd = port->hpd;
@@ -1399,13 +1400,13 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
        unsigned windex;
        unsigned wvalue;
        unsigned wlength;
-       void *hpd = 0;
+       void *hpd = NULL;
        u8 req_id;
        int rc = 0;
        unsigned complete = 0;
 
        int port_ix = -1;
-       struct oz_port *port = 0;
+       struct oz_port *port = NULL;
 
        oz_trace2(OZ_TRACE_URB, "%lu: oz_process_ep0_urb(%p)\n", jiffies, urb);
        port_ix = oz_get_port_from_addr(ozhcd, urb->dev->devnum);
@@ -1437,7 +1438,7 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
 
        req_id = port->next_req_id++;
        hpd = oz_claim_hpd(port);
-       if (hpd == 0) {
+       if (hpd == NULL) {
                oz_trace("Cannot claim port\n");
                rc = -EPIPE;
                goto out;
@@ -1452,7 +1453,7 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
                        break;
                case USB_REQ_SET_ADDRESS:
                        oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest,
-                               0, 0, setup->bRequestType);
+                               0, NULL, setup->bRequestType);
                        oz_trace("USB_REQ_SET_ADDRESS - req\n");
                        oz_trace("Port %d address is 0x%x\n", ozhcd->conn_port,
                                (u8)le16_to_cpu(setup->wValue));
@@ -1473,8 +1474,8 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
                        /* We short circuit this case and reply directly since
                         * we have the selected configuration number cached.
                         */
-                       oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0, 0,
-                               setup->bRequestType);
+                       oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0,
+                                    NULL, setup->bRequestType);
                        oz_trace("USB_REQ_GET_CONFIGURATION - reply now\n");
                        if (urb->transfer_buffer_length >= 1) {
                                urb->actual_length = 1;
@@ -1489,8 +1490,8 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
                        /* We short circuit this case and reply directly since
                         * we have the selected interface alternative cached.
                         */
-                       oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0, 0,
-                               setup->bRequestType);
+                       oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0,
+                                    NULL, setup->bRequestType);
                        oz_trace("USB_REQ_GET_INTERFACE - reply now\n");
                        if (urb->transfer_buffer_length >= 1) {
                                urb->actual_length = 1;
@@ -1583,7 +1584,7 @@ static void oz_urb_process_tasklet(unsigned long unused)
        struct urb *urb;
        struct oz_hcd *ozhcd = oz_hcd_claim();
        int rc = 0;
-       if (ozhcd == 0)
+       if (ozhcd == NULL)
                return;
        /* This is called from a tasklet so is in softirq context but the urb
         * list is filled from any context so we need to lock
@@ -1617,17 +1618,17 @@ static void oz_urb_process_tasklet(unsigned long unused)
  */
 static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb)
 {
-       struct oz_urb_link *urbl = 0;
+       struct oz_urb_link *urbl = NULL;
        struct list_head *e;
        struct oz_hcd *ozhcd;
        unsigned long irq_state;
        u8 ix;
-       if (port == 0) {
+       if (port == NULL) {
                oz_trace("ERRORERROR: oz_urb_cancel(%p) port is null\n", urb);
                return;
        }
        ozhcd = port->ozhcd;
-       if (ozhcd == 0) {
+       if (ozhcd == NULL) {
                oz_trace("ERRORERROR: oz_urb_cancel(%p) ozhcd is null\n", urb);
                return;
        }
@@ -1644,7 +1645,7 @@ static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb)
                }
        }
        spin_unlock_irqrestore(&g_tasklet_lock, irq_state);
-       urbl = 0;
+       urbl = NULL;
 
        /* Look in the orphanage.
         */
@@ -1658,7 +1659,7 @@ static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb)
                }
        }
        ix = (ep_num & 0xf);
-       urbl = 0;
+       urbl = NULL;
        if ((ep_num & USB_DIR_IN) && ix)
                urbl = oz_remove_urb(port->in_ep[ix], urb);
        else
@@ -1680,7 +1681,7 @@ static void oz_urb_cancel_tasklet(unsigned long unused)
        unsigned long irq_state;
        struct urb *urb;
        struct oz_hcd *ozhcd = oz_hcd_claim();
-       if (ozhcd == 0)
+       if (ozhcd == NULL)
                return;
        spin_lock_irqsave(&g_tasklet_lock, irq_state);
        while (!list_empty(&ozhcd->urb_cancel_list)) {
@@ -1772,7 +1773,7 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
                jiffies, urb);
        oz_event_log(OZ_EVT_URB_SUBMIT, oz_get_irq_ctx(),
                (u16)urb->number_of_packets, urb, urb->pipe);
-       if (unlikely(ozhcd == 0)) {
+       if (unlikely(ozhcd == NULL)) {
                oz_trace2(OZ_TRACE_URB, "%lu: Refused urb(%p) not ozhcd.\n",
                        jiffies, urb);
                return -EPIPE;
@@ -1786,7 +1787,7 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
        if (port_ix < 0)
                return -EPIPE;
        port =  &ozhcd->ports[port_ix];
-       if (port == 0)
+       if (port == NULL)
                return -EPIPE;
        if ((port->flags & OZ_PORT_F_PRESENT) == 0) {
                oz_trace("Refusing URB port_ix = %d devnum = %d\n",
@@ -1797,7 +1798,7 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
        /* Put request in queue for processing by tasklet.
         */
        urbl = oz_alloc_urb_link();
-       if (unlikely(urbl == 0))
+       if (unlikely(urbl == NULL))
                return -ENOMEM;
        urbl->urb = urb;
        spin_lock_irqsave(&g_tasklet_lock, irq_state);
@@ -1819,10 +1820,10 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
 static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep,
                                struct urb *urb)
 {
-       struct oz_urb_link *urbl = 0;
+       struct oz_urb_link *urbl = NULL;
        struct list_head *e;
-       if (unlikely(ep == 0))
-               return 0;
+       if (unlikely(ep == NULL))
+               return NULL;
        list_for_each(e, &ep->urb_list) {
                urbl = container_of(e, struct oz_urb_link, link);
                if (urbl->urb == urb) {
@@ -1834,12 +1835,12 @@ static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep,
                                oz_event_log(OZ_EVT_EP_CREDIT,
                                        usb_pipein(urb->pipe) ?
                                        (ep->ep_num | USB_DIR_IN) : ep->ep_num,
-                                       0, 0, ep->credit);
+                                       0, NULL, ep->credit);
                        }
                        return urbl;
                }
        }
-       return 0;
+       return NULL;
 }
 /*------------------------------------------------------------------------------
  * Called to dequeue a previously submitted urb for the device.
@@ -1848,12 +1849,12 @@ static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep,
 static int oz_hcd_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
 {
        struct oz_hcd *ozhcd = oz_hcd_private(hcd);
-       struct oz_urb_link *urbl = 0;
+       struct oz_urb_link *urbl = NULL;
        int rc;
        unsigned long irq_state;
        oz_trace2(OZ_TRACE_URB, "%lu: oz_hcd_urb_dequeue(%p)\n", jiffies, urb);
        urbl = oz_alloc_urb_link();
-       if (unlikely(urbl == 0))
+       if (unlikely(urbl == NULL))
                return -ENOMEM;
        spin_lock_irqsave(&g_tasklet_lock, irq_state);
        /* The following function checks the urb is still in the queue
@@ -2193,7 +2194,7 @@ static int oz_plat_probe(struct platform_device *dev)
        struct oz_hcd *ozhcd;
        oz_trace("oz_plat_probe()\n");
        hcd = usb_create_hcd(&g_oz_hc_drv, &dev->dev, dev_name(&dev->dev));
-       if (hcd == 0) {
+       if (hcd == NULL) {
                oz_trace("Failed to created hcd object OK\n");
                return -ENOMEM;
        }
@@ -2232,12 +2233,12 @@ static int oz_plat_remove(struct platform_device *dev)
        struct usb_hcd *hcd = platform_get_drvdata(dev);
        struct oz_hcd *ozhcd;
        oz_trace("oz_plat_remove()\n");
-       if (hcd == 0)
+       if (hcd == NULL)
                return -1;
        ozhcd = oz_hcd_private(hcd);
        spin_lock_bh(&g_hcdlock);
        if (ozhcd == g_ozhcd)
-               g_ozhcd = 0;
+               g_ozhcd = NULL;
        spin_unlock_bh(&g_hcdlock);
        oz_trace("Clearing orphanage\n");
        oz_hcd_clear_orphanage(ozhcd, -EPIPE);
@@ -2278,7 +2279,7 @@ int oz_hcd_init(void)
        if (err)
                goto error;
        g_plat_dev = platform_device_alloc(OZ_PLAT_DEV_NAME, -1);
-       if (g_plat_dev == 0) {
+       if (g_plat_dev == NULL) {
                err = -ENOMEM;
                goto error1;
        }