Skip to content

Commit

Permalink
USB: test for NULL return from platform_get_resource() in ohci_hcd_sm…
Browse files Browse the repository at this point in the history
…501_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>
  • Loading branch information
Jesper Juhl authored and Greg Kroah-Hartman committed Apr 25, 2008
1 parent e04d80b commit 119fc8c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/host/ohci-sm501.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down

0 comments on commit 119fc8c

Please sign in to comment.