MTD: nand: Fix release_mem_region() size
Subsystems (2)
PATCH 1/1 MTD: nand: Fix release_mem_region() size
In au1550nd_probe(), request_mem_region() is called with size resource_size(r), and release_mem_region() is called in the error path with the same size. Howeve, in the cleanup function au1550nd_remove() calls release_mem_region() with size 0x1000.
Change release size to match request.
--- drivers/mtd/nand/raw/au1550nd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/au1550nd.c +1 -1
@@ -348,7 +348,7 @@ static void au1550nd_remove(struct platform_device *pdev)WARN_ON (ret);nand_cleanup (chip);iounmap (ctx->base); -release_mem_region (r->start,0x1000 ); +release_mem_region (r->start,resource_size (r));kfree (ctx); }
Signature · 1 line
2.53.0
Miquel Raynal
maintainerHi Thomas,
Quoted 10 lines
In
au1550nd_probe(),request_mem_region()is called with sizeresource_size(r), andrelease_mem_region()is called in the error path with the same size. Howeve, in the cleanup functionau1550nd_remove()callsrelease_mem_region()with size0x1000.Change release size to match request.
Fixes b67a1a02d463 ("MTD: nand: make au1550nd.c a platform_driver")Signed-off-by Thomas Fourier <[email protected]>---
This driver is very old. If you care about cleaning it up, I would suggest doing something bigger. For instance platform_get_resource, request_mem_region and ioremap are now a single helper named devm_platform_ioremap_resource(). The kzalloc could also become device managed. This will further reduce the size of the error path and the removal.
The subject prefix btw should be updated to match today's standards (see git log --oneline -- drivers/mtd/nand/raw/).
Do you own the hardware?
Thanks,
Miquèl