lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140507220959.GE19102@atomide.com>
Date:	Wed, 7 May 2014 15:10:00 -0700
From:	Tony Lindgren <tony@...mide.com>
To:	Joel Fernandes <joelf@...com>
Cc:	Linux OMAP List <linux-omap@...r.kernel.org>,
	Linux ARM Kernel List <linux-arm-kernel@...ts.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 09/26] ARM: OMAP: dmtimer: Get rid of check for mem
 resource error

* Joel Fernandes <joelf@...com> [140507 14:53]:
> On 05/07/2014 10:24 AM, Tony Lindgren wrote:
> > * Joel Fernandes <joelf@...com> [140424 14:44]:
> >> The subsequent devm_ioremap_resource will catch it and print an error, let it
> >> be checked there.
> >>
> >> Signed-off-by: Joel Fernandes <joelf@...com>
> >> ---
> >>  arch/arm/plat-omap/dmtimer.c |    4 ----
> >>  1 file changed, 4 deletions(-)
> >>
> >> diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
> >> index 7e806f9..1fd30fa 100644
> >> --- a/arch/arm/plat-omap/dmtimer.c
> >> +++ b/arch/arm/plat-omap/dmtimer.c
> >> @@ -810,10 +810,6 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
> >>  	}
> >>  
> >>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >> -	if (unlikely(!mem)) {
> >> -		dev_err(dev, "%s: no memory resource.\n", __func__);
> >> -		return -ENODEV;
> >> -	}
> >>  
> >>  	timer = devm_kzalloc(dev, sizeof(struct omap_dm_timer), GFP_KERNEL);
> >>  	if (!timer) {
> > 
> > We still need to return an error here and not try to continue though.
> 
> We are returning an error if mem is NULL so the redundant check is
> unnecessary:
> 
> ...
>         timer->io_base = devm_ioremap_resource(dev, mem);
>         if (IS_ERR(timer->io_base))
>                 return PTR_ERR(timer->io_base);

Why would you want to even continue omap_dm_timer_probe()
further and allocate memory if platform_get_resource() fails?

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ