Commit 326b4810 authored by Randy Dunlap's avatar Randy Dunlap Committed by Greg Kroah-Hartman

USB: clean up some host controller sparse warnings

Fix usb sparse warnings:

drivers/usb/host/isp1362-hcd.c:2220:50: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-mem.c:43:24: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-mem.c:49:24: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-mem.c:161:24: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-mem.c:198:16: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-mem.c:319:31: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-mem.c:1231:33: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-pci.c:177:23: warning: non-ANSI function declaration of function 'xhci_register_pci'
drivers/usb/host/xhci-pci.c:182:26: warning: non-ANSI function declaration of function 'xhci_unregister_pci'
drivers/usb/host/xhci-ring.c:342:32: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-ring.c:525:34: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-ring.c:1009:32: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-ring.c:1031:32: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-ring.c:1041:16: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-ring.c:1096:30: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-ring.c:1100:27: warning: Using plain integer as NULL pointer
drivers/usb/host/xhci-mem.c:224:27: warning: symbol 'xhci_alloc_container_ctx' was not declared. Should it be static?
drivers/usb/host/xhci-mem.c:242:6: warning: symbol 'xhci_free_container_ctx' was not declared. Should it be static?
Signed-off-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
Cc: Lothar Wassmann <LW@KARO-electronics.de>
Signed-off By: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e8f4af30
...@@ -2217,7 +2217,7 @@ static void create_debug_file(struct isp1362_hcd *isp1362_hcd) ...@@ -2217,7 +2217,7 @@ static void create_debug_file(struct isp1362_hcd *isp1362_hcd)
static void remove_debug_file(struct isp1362_hcd *isp1362_hcd) static void remove_debug_file(struct isp1362_hcd *isp1362_hcd)
{ {
if (isp1362_hcd->pde) if (isp1362_hcd->pde)
remove_proc_entry(proc_filename, 0); remove_proc_entry(proc_filename, NULL);
} }
#endif #endif
......
...@@ -41,13 +41,13 @@ static struct xhci_segment *xhci_segment_alloc(struct xhci_hcd *xhci, gfp_t flag ...@@ -41,13 +41,13 @@ static struct xhci_segment *xhci_segment_alloc(struct xhci_hcd *xhci, gfp_t flag
seg = kzalloc(sizeof *seg, flags); seg = kzalloc(sizeof *seg, flags);
if (!seg) if (!seg)
return 0; return NULL;
xhci_dbg(xhci, "Allocating priv segment structure at %p\n", seg); xhci_dbg(xhci, "Allocating priv segment structure at %p\n", seg);
seg->trbs = dma_pool_alloc(xhci->segment_pool, flags, &dma); seg->trbs = dma_pool_alloc(xhci->segment_pool, flags, &dma);
if (!seg->trbs) { if (!seg->trbs) {
kfree(seg); kfree(seg);
return 0; return NULL;
} }
xhci_dbg(xhci, "// Allocating segment at %p (virtual) 0x%llx (DMA)\n", xhci_dbg(xhci, "// Allocating segment at %p (virtual) 0x%llx (DMA)\n",
seg->trbs, (unsigned long long)dma); seg->trbs, (unsigned long long)dma);
...@@ -159,7 +159,7 @@ static struct xhci_ring *xhci_ring_alloc(struct xhci_hcd *xhci, ...@@ -159,7 +159,7 @@ static struct xhci_ring *xhci_ring_alloc(struct xhci_hcd *xhci,
ring = kzalloc(sizeof *(ring), flags); ring = kzalloc(sizeof *(ring), flags);
xhci_dbg(xhci, "Allocating ring at %p\n", ring); xhci_dbg(xhci, "Allocating ring at %p\n", ring);
if (!ring) if (!ring)
return 0; return NULL;
INIT_LIST_HEAD(&ring->td_list); INIT_LIST_HEAD(&ring->td_list);
if (num_segs == 0) if (num_segs == 0)
...@@ -196,7 +196,7 @@ static struct xhci_ring *xhci_ring_alloc(struct xhci_hcd *xhci, ...@@ -196,7 +196,7 @@ static struct xhci_ring *xhci_ring_alloc(struct xhci_hcd *xhci,
fail: fail:
xhci_ring_free(xhci, ring); xhci_ring_free(xhci, ring);
return 0; return NULL;
} }
void xhci_free_or_cache_endpoint_ring(struct xhci_hcd *xhci, void xhci_free_or_cache_endpoint_ring(struct xhci_hcd *xhci,
...@@ -247,7 +247,7 @@ static void xhci_reinit_cached_ring(struct xhci_hcd *xhci, ...@@ -247,7 +247,7 @@ static void xhci_reinit_cached_ring(struct xhci_hcd *xhci,
#define CTX_SIZE(_hcc) (HCC_64BYTE_CONTEXT(_hcc) ? 64 : 32) #define CTX_SIZE(_hcc) (HCC_64BYTE_CONTEXT(_hcc) ? 64 : 32)
struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci, static struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci,
int type, gfp_t flags) int type, gfp_t flags)
{ {
struct xhci_container_ctx *ctx = kzalloc(sizeof(*ctx), flags); struct xhci_container_ctx *ctx = kzalloc(sizeof(*ctx), flags);
...@@ -265,7 +265,7 @@ struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci, ...@@ -265,7 +265,7 @@ struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci,
return ctx; return ctx;
} }
void xhci_free_container_ctx(struct xhci_hcd *xhci, static void xhci_free_container_ctx(struct xhci_hcd *xhci,
struct xhci_container_ctx *ctx) struct xhci_container_ctx *ctx)
{ {
if (!ctx) if (!ctx)
...@@ -764,7 +764,7 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id) ...@@ -764,7 +764,7 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id)
xhci_free_container_ctx(xhci, dev->out_ctx); xhci_free_container_ctx(xhci, dev->out_ctx);
kfree(xhci->devs[slot_id]); kfree(xhci->devs[slot_id]);
xhci->devs[slot_id] = 0; xhci->devs[slot_id] = NULL;
} }
int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id,
...@@ -1779,7 +1779,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) ...@@ -1779,7 +1779,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
*/ */
init_completion(&xhci->addr_dev); init_completion(&xhci->addr_dev);
for (i = 0; i < MAX_HC_SLOTS; ++i) for (i = 0; i < MAX_HC_SLOTS; ++i)
xhci->devs[i] = 0; xhci->devs[i] = NULL;
if (scratchpad_alloc(xhci, flags)) if (scratchpad_alloc(xhci, flags))
goto fail; goto fail;
......
...@@ -177,12 +177,12 @@ static struct pci_driver xhci_pci_driver = { ...@@ -177,12 +177,12 @@ static struct pci_driver xhci_pci_driver = {
.shutdown = usb_hcd_pci_shutdown, .shutdown = usb_hcd_pci_shutdown,
}; };
int xhci_register_pci() int xhci_register_pci(void)
{ {
return pci_register_driver(&xhci_pci_driver); return pci_register_driver(&xhci_pci_driver);
} }
void xhci_unregister_pci() void xhci_unregister_pci(void)
{ {
pci_unregister_driver(&xhci_pci_driver); pci_unregister_driver(&xhci_pci_driver);
} }
...@@ -388,7 +388,7 @@ static struct xhci_segment *find_trb_seg( ...@@ -388,7 +388,7 @@ static struct xhci_segment *find_trb_seg(
cur_seg = cur_seg->next; cur_seg = cur_seg->next;
if (cur_seg == start_seg) if (cur_seg == start_seg)
/* Looped over the entire list. Oops! */ /* Looped over the entire list. Oops! */
return 0; return NULL;
} }
return cur_seg; return cur_seg;
} }
...@@ -582,7 +582,7 @@ static void handle_stopped_endpoint(struct xhci_hcd *xhci, ...@@ -582,7 +582,7 @@ static void handle_stopped_endpoint(struct xhci_hcd *xhci,
struct xhci_ring *ep_ring; struct xhci_ring *ep_ring;
struct xhci_virt_ep *ep; struct xhci_virt_ep *ep;
struct list_head *entry; struct list_head *entry;
struct xhci_td *cur_td = 0; struct xhci_td *cur_td = NULL;
struct xhci_td *last_unlinked_td; struct xhci_td *last_unlinked_td;
struct xhci_dequeue_state deq_state; struct xhci_dequeue_state deq_state;
...@@ -1115,7 +1115,7 @@ struct xhci_segment *trb_in_td(struct xhci_segment *start_seg, ...@@ -1115,7 +1115,7 @@ struct xhci_segment *trb_in_td(struct xhci_segment *start_seg,
do { do {
if (start_dma == 0) if (start_dma == 0)
return 0; return NULL;
/* We may get an event for a Link TRB in the middle of a TD */ /* We may get an event for a Link TRB in the middle of a TD */
end_seg_dma = xhci_trb_virt_to_dma(cur_seg, end_seg_dma = xhci_trb_virt_to_dma(cur_seg,
&cur_seg->trbs[TRBS_PER_SEGMENT - 1]); &cur_seg->trbs[TRBS_PER_SEGMENT - 1]);
...@@ -1137,7 +1137,7 @@ struct xhci_segment *trb_in_td(struct xhci_segment *start_seg, ...@@ -1137,7 +1137,7 @@ struct xhci_segment *trb_in_td(struct xhci_segment *start_seg,
suspect_dma <= end_trb_dma)) suspect_dma <= end_trb_dma))
return cur_seg; return cur_seg;
} }
return 0; return NULL;
} else { } else {
/* Might still be somewhere in this segment */ /* Might still be somewhere in this segment */
if (suspect_dma >= start_dma && suspect_dma <= end_seg_dma) if (suspect_dma >= start_dma && suspect_dma <= end_seg_dma)
...@@ -1147,7 +1147,7 @@ struct xhci_segment *trb_in_td(struct xhci_segment *start_seg, ...@@ -1147,7 +1147,7 @@ struct xhci_segment *trb_in_td(struct xhci_segment *start_seg,
start_dma = xhci_trb_virt_to_dma(cur_seg, &cur_seg->trbs[0]); start_dma = xhci_trb_virt_to_dma(cur_seg, &cur_seg->trbs[0]);
} while (cur_seg != start_seg); } while (cur_seg != start_seg);
return 0; return NULL;
} }
static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci, static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci,
...@@ -1223,11 +1223,11 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -1223,11 +1223,11 @@ static int handle_tx_event(struct xhci_hcd *xhci,
struct xhci_ring *ep_ring; struct xhci_ring *ep_ring;
unsigned int slot_id; unsigned int slot_id;
int ep_index; int ep_index;
struct xhci_td *td = 0; struct xhci_td *td = NULL;
dma_addr_t event_dma; dma_addr_t event_dma;
struct xhci_segment *event_seg; struct xhci_segment *event_seg;
union xhci_trb *event_trb; union xhci_trb *event_trb;
struct urb *urb = 0; struct urb *urb = NULL;
int status = -EINPROGRESS; int status = -EINPROGRESS;
struct xhci_ep_ctx *ep_ctx; struct xhci_ep_ctx *ep_ctx;
u32 trb_comp_code; u32 trb_comp_code;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment