From 92f8e76769c687a7c38c5067ff375c187666ac18 Mon Sep 17 00:00:00 2001 From: Sarah Sharp Date: Tue, 23 Apr 2013 17:11:14 -0700 Subject: xhci: Remove BUG_ON in xhci_get_input_control_ctx. Fail gracefully, instead of causing the kernel to panic, if the input control context doesn't have the right type (XHCI_CTX_TYPE_INPUT). Push finding the pointer to the input control context up into functions that can fail. Signed-off-by: Sarah Sharp Cc: John Youn --- drivers/usb/host/xhci-dbg.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/usb/host/xhci-dbg.c') diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index f2e7689e11a3..5d5e58fdeccc 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c @@ -553,6 +553,11 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci, if (ctx->type == XHCI_CTX_TYPE_INPUT) { struct xhci_input_control_ctx *ctrl_ctx = xhci_get_input_control_ctx(xhci, ctx); + if (!ctrl_ctx) { + xhci_warn(xhci, "Could not get input context, bad type.\n"); + return; + } + xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - drop flags\n", &ctrl_ctx->drop_flags, (unsigned long long)dma, ctrl_ctx->drop_flags); -- cgit v1.2.3