From: Jesper Juhl Date: Fri, 21 Mar 2008 21:55:45 +0000 (+0100) Subject: USB: test for NULL return from platform_get_resource() in ohci_hcd_sm501_drv_remove() X-Git-Tag: MMI-PSA29.97-13-9~35531^2~46 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=119fc8c9acde650fb92b44c34ea6fc84feb0f6dd;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git USB: test for NULL return from platform_get_resource() in ohci_hcd_sm501_drv_remove() platform_get_resource() may return null, so although it seems it will never do so here unless there's a bug elsewhere, it does no harm to be defensive and test. Signed-off-by: Jesper Juhl Acked-by: David Brownell Acked-by: Magnus Damm Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index ab1e366d7790..54b6ac2e3e4a 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c @@ -199,7 +199,8 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev) usb_put_hcd(hcd); dma_release_declared_memory(&pdev->dev); mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); - release_mem_region(mem->start, mem->end - mem->start + 1); + if (mem) + release_mem_region(mem->start, mem->end - mem->start + 1); /* mask interrupts and disable power */