* [PATCH] test for NULL return from platform_get_resource() in ohci_hcd_sm501_drv_remove()
@ 2008-03-21 21:55 Jesper Juhl
2008-03-27 19:27 ` David Brownell
0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2008-03-21 21:55 UTC (permalink / raw)
To: linux-usb; +Cc: Roman Weissgaerber, Lennert Buytenhek, Greg KH, LKML
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>
---
ohci-sm501.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index a970701..1ffc272 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 */
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] test for NULL return from platform_get_resource() in ohci_hcd_sm501_drv_remove()
2008-03-21 21:55 [PATCH] test for NULL return from platform_get_resource() in ohci_hcd_sm501_drv_remove() Jesper Juhl
@ 2008-03-27 19:27 ` David Brownell
2008-03-28 8:48 ` Magnus Damm
0 siblings, 1 reply; 3+ messages in thread
From: David Brownell @ 2008-03-27 19:27 UTC (permalink / raw)
To: Jesper Juhl
Cc: linux-usb, Roman Weissgaerber, Lennert Buytenhek, Greg KH, LKML,
Magnus Damm
On Friday 21 March 2008, Jesper Juhl wrote:
>
> 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>
(and cc the author of that code: Magnus Damm <magnus.damm@gmail.com>)
> ---
>
> ohci-sm501.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
> index a970701..1ffc272 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 */
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] test for NULL return from platform_get_resource() in ohci_hcd_sm501_drv_remove()
2008-03-27 19:27 ` David Brownell
@ 2008-03-28 8:48 ` Magnus Damm
0 siblings, 0 replies; 3+ messages in thread
From: Magnus Damm @ 2008-03-28 8:48 UTC (permalink / raw)
To: David Brownell
Cc: Jesper Juhl, linux-usb, Roman Weissgaerber, Lennert Buytenhek,
Greg KH, LKML
On Fri, Mar 28, 2008 at 4:27 AM, David Brownell <david-b@pacbell.net> wrote:
> On Friday 21 March 2008, Jesper Juhl wrote:
> >
> > 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-28 8:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-21 21:55 [PATCH] test for NULL return from platform_get_resource() in ohci_hcd_sm501_drv_remove() Jesper Juhl
2008-03-27 19:27 ` David Brownell
2008-03-28 8:48 ` Magnus Damm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).