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]
Date:	Tue, 26 Nov 2013 10:13:17 +0200
From:	Stefan Kristiansson <stefan.kristiansson@...nalahti.fi>
To:	Michal Simek <monstr@...str.eu>
Cc:	linux-kernel@...r.kernel.org, linux-fbdev@...r.kernel.org,
	tomi.valkeinen@...com, plagnioj@...osoft.com
Subject: Re: [PATCH v3] video: add OpenCores VGA/LCD framebuffer driver

On Tue, Nov 26, 2013 at 08:10:46AM +0100, Michal Simek wrote:
> On 11/22/2013 05:34 AM, Stefan Kristiansson wrote:
> > +
> > +	/* Request I/O resource */
> > +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > +	if (!res) {
> > +		dev_err(&pdev->dev, "I/O resource request failed\n");
> > +		return -ENXIO;
> > +	}
> > +	fbdev->regs_phys = res->start;
> > +	fbdev->regs_phys_size = resource_size(res);
> > +	mmio = devm_request_mem_region(&pdev->dev, res->start,
> > +				       resource_size(res), res->name);
> > +	if (!mmio) {
> > +		dev_err(&pdev->dev, "I/O memory space request failed\n");
> > +		return -ENXIO;
> > +	}
> > +	fbdev->regs = devm_ioremap_nocache(&pdev->dev, mmio->start,
> > +					   resource_size(mmio));
> > +	if (!fbdev->regs) {
> > +		dev_err(&pdev->dev, "I/O memory remap request failed\n");
> > +		return -ENXIO;
> > +	}
> 
> 
> This construction seems to me too complicated and can be simpler.
> 
> What about this?
> 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> 	res->flags &= ~IORESOURCE_CACHEABLE;
> 	fbdev->regs = devm_ioremap_resource(&pdev->dev, res);
> 	if (IS_ERR(fbdev->regs))
> 		return PTR_ERR(fbdev->regs);
> 

Yes, that looks better.

Slightly related, I also noticed that I have a release_mem_region even though I
used devm_request_mem_region to request it.
I will fix that as well.

Stefan
--
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