Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759862AbYC0ToT (ORCPT ); Thu, 27 Mar 2008 15:44:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757785AbYC0ToH (ORCPT ); Thu, 27 Mar 2008 15:44:07 -0400 Received: from smtp121.sbc.mail.sp1.yahoo.com ([69.147.64.94]:32935 "HELO smtp121.sbc.mail.sp1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1757720AbYC0ToG (ORCPT ); Thu, 27 Mar 2008 15:44:06 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=pacbell.net; h=Received:X-YMail-OSG:X-Yahoo-Newman-Property:From:To:Subject:Date:User-Agent:Cc:References:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-Disposition:Message-Id; b=bt8DyuofwiZTLRnxDIe2gC/+fZJBQ6GEjftlPOFAErg7t+vGSfTSAnGHisrfH8Ao05X4RbrF6JMZBWHtSmTfdGQO8iXgPEcDJ5wuae2MXwmpFjbXM5x7VzZ+RxqQ5yGgQw2DXgnDem5bSyquz3VnEFl0+fM/NiQi6RWVemMxuBQ= ; X-YMail-OSG: zZ_Mb8gVM1kZnFpz2F90obFeMKizuVVXGrXt_fBUBzcQf26Cl7V_hLv6w8As.0SJ9rIexOrnCcJcclsA8mjJ603tk70loi9_CHciTkBOGgHOwNdctTDMhDcmrmtK X-Yahoo-Newman-Property: ymail-3 From: David Brownell To: Jesper Juhl Subject: Re: [PATCH] test for NULL return from platform_get_resource() in ohci_hcd_sm501_drv_remove() Date: Thu, 27 Mar 2008 12:27:46 -0700 User-Agent: KMail/1.9.6 Cc: linux-usb@vger.kernel.org, Roman Weissgaerber , Lennert Buytenhek , Greg KH , LKML , Magnus Damm References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200803271227.46818.david-b@pacbell.net> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1541 Lines: 45 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 Acked-by: David Brownell (and cc the author of that code: Magnus Damm ) > --- > > 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 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/