summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2008-03-21 22:55:45 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-24 21:16:45 -0700
commit119fc8c9acde650fb92b44c34ea6fc84feb0f6dd (patch)
tree7210bc10f578254b107b02d9657a95226a0ed94b /drivers/usb
parente04d80b03d2a116ddd6eb9140c8c83760c315b94 (diff)
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 <jesper.juhl@gmail.com> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Acked-by: Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ohci-sm501.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index ab1e366d779..54b6ac2e3e4 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 */