All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Anton Vasilyev <vasilyev@ispras.ru>
Cc: David Woodhouse <dwmw2@infradead.org>,
	ldv-project@linuxtesting.org, Richard Weinberger <richard@nod.at>,
	linux-kernel@vger.kernel.org, Marek Vasut <marek.vasut@gmail.com>,
	linux-mtd@lists.infradead.org,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
	Brian Norris <computersforpeace@gmail.com>
Subject: Re: [PATCH] mtd: plat-ram: use release_mem_region instead of release_resource
Date: Tue, 15 Aug 2017 11:01:59 +0200	[thread overview]
Message-ID: <20170815110159.39ebdeb6@bbrezillon> (raw)
In-Reply-To: <1502456103-1576-1-git-send-email-vasilyev@ispras.ru>

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)

      reply	other threads:[~2017-08-15  9:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170815110159.39ebdeb6@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    --cc=vasilyev@ispras.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.