mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mtd: plat-ram: use release_mem_region instead of release_resource
@ 2017-08-11 12:55 Anton Vasilyev
  2017-08-15  9:01 ` Boris Brezillon
  0 siblings, 1 reply; 2+ messages in thread
From: Anton Vasilyev @ 2017-08-11 12:55 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Anton Vasilyev, Brian Norris, Boris Brezillon, Marek Vasut,
	Richard Weinberger, Cyrille Pitchen, linux-mtd, linux-kernel,
	ldv-project

Use api pair of request_mem_region and release_mem_region
instead of release_resource.

Found by Linux Driver Verification project (linuxtesting.

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
---
 drivers/mtd/maps/plat-ram.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c
index 5157289..baaf146 100644
--- a/drivers/mtd/maps/plat-ram.c
+++ b/drivers/mtd/maps/plat-ram.c
@@ -82,6 +82,7 @@ static inline void platram_setrw(struct platram_info *info, int to)
 static int platram_remove(struct platform_device *pdev)
 {
 	struct platram_info *info = to_platram_info(pdev);
+	resource_size_t res_size;
 
 	dev_dbg(&pdev->dev, "removing device\n");
 
@@ -100,8 +101,8 @@ static int platram_remove(struct platform_device *pdev)
 	/* release resources */
 
 	if (info->area) {
-		release_resource(info->area);
-		kfree(info->area);
+		res_size = resource_size(info->area)
+		release_mem_region(info->area->start, res_size);
 	}
 
 	if (info->map.virt != NULL)
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: plat-ram: use release_mem_region instead of release_resource
  2017-08-11 12:55 [PATCH] mtd: plat-ram: use release_mem_region instead of release_resource Anton Vasilyev
@ 2017-08-15  9:01 ` Boris Brezillon
  0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2017-08-15  9:01 UTC (permalink / raw)
  To: Anton Vasilyev
  Cc: David Woodhouse, ldv-project, Richard Weinberger, linux-kernel,
	Marek Vasut, linux-mtd, Cyrille Pitchen, Brian Norris

Le Fri, 11 Aug 2017 15:55:03 +0300,
Anton Vasilyev <vasilyev@ispras.ru> a écrit :

> Use api pair of request_mem_region and release_mem_region
> instead of release_resource.
> 
> Found by Linux Driver Verification project (linuxtesting.
> 
> Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
> ---
>  drivers/mtd/maps/plat-ram.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c
> index 5157289..baaf146 100644
> --- a/drivers/mtd/maps/plat-ram.c
> +++ b/drivers/mtd/maps/plat-ram.c
> @@ -82,6 +82,7 @@ static inline void platram_setrw(struct platram_info *info, int to)
>  static int platram_remove(struct platform_device *pdev)
>  {
>  	struct platram_info *info = to_platram_info(pdev);
> +	resource_size_t res_size;
>  
>  	dev_dbg(&pdev->dev, "removing device\n");
>  
> @@ -100,8 +101,8 @@ static int platram_remove(struct platform_device *pdev)
>  	/* release resources */
>  
>  	if (info->area) {
> -		release_resource(info->area);
> -		kfree(info->area);
> +		res_size = resource_size(info->area)

Missing semi-colon here, which means you did not even compile-test your
changes :P.

> +		release_mem_region(info->area->start, res_size);

Why adding a res_size variable instead of doing

		release_mem_region(info->area->start,
				   resource_size(info->area);

?

>  	}
>  
>  	if (info->map.virt != NULL)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-15  9:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-11 12:55 [PATCH] mtd: plat-ram: use release_mem_region instead of release_resource Anton Vasilyev
2017-08-15  9:01 ` Boris Brezillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome