aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-mem.c
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2013-04-23 18:49:47 -0400
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2013-06-14 16:43:43 -0400
commit29f9d54b63a6186f1bed3fc15eeab7f98947eebd (patch)
tree39ecda3c7042ec1a4d37cb3b1a36115593fb02d8 /drivers/usb/host/xhci-mem.c
parent976f8bef9cfb5246bc0e8dc781562daa79cb7aaf (diff)
xhci: Remove BUG_ON() in xhci_alloc_container_ctx.
It's horrible coding style to panic the kernel when someone passes you an argument value you didn't expect. In the future, we may want to add additional context types, so it's better to gracefully handle additional context types instead of panicking. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: John Youn <johnyoun@synopsys.com>
Diffstat (limited to 'drivers/usb/host/xhci-mem.c')
-rw-r--r--drivers/usb/host/xhci-mem.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 8c0e119efa4e..cc1b3efd5d76 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -358,11 +358,15 @@ int xhci_ring_expansion(struct xhci_hcd *xhci, struct xhci_ring *ring,
358static struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci, 358static struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci,
359 int type, gfp_t flags) 359 int type, gfp_t flags)
360{ 360{
361 struct xhci_container_ctx *ctx = kzalloc(sizeof(*ctx), flags); 361 struct xhci_container_ctx *ctx;
362
363 if ((type != XHCI_CTX_TYPE_DEVICE) && (type != XHCI_CTX_TYPE_INPUT))
364 return NULL;
365
366 ctx = kzalloc(sizeof(*ctx), flags);
362 if (!ctx) 367 if (!ctx)
363 return NULL; 368 return NULL;
364 369
365 BUG_ON((type != XHCI_CTX_TYPE_DEVICE) && (type != XHCI_CTX_TYPE_INPUT));
366 ctx->type = type; 370 ctx->type = type;
367 ctx->size = HCC_64BYTE_CONTEXT(xhci->hcc_params) ? 2048 : 1024; 371 ctx->size = HCC_64BYTE_CONTEXT(xhci->hcc_params) ? 2048 : 1024;
368 if (type == XHCI_CTX_TYPE_INPUT) 372 if (type == XHCI_CTX_TYPE_INPUT)