public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Chuhong Yuan <hslester96@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mfd: sm501: fix mismatches of request_mem_region
Date: Mon, 9 Dec 2019 09:00:20 +0000	[thread overview]
Message-ID: <20191209090020.GG3468@dell> (raw)
In-Reply-To: <20191116151308.17817-1-hslester96@gmail.com>

On Sat, 16 Nov 2019, Chuhong Yuan wrote:

> This driver misuses release_resource + kfree to match request_mem_region,
> which is incorrect.
> The right way is to use release_mem_region.
> Replace the mismatched calls with the right ones to fix it.
> 
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> ---
>  drivers/mfd/sm501.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
> index 154270f8d8d7..e49787e6bb93 100644
> --- a/drivers/mfd/sm501.c
> +++ b/drivers/mfd/sm501.c
> @@ -1086,8 +1086,7 @@ static int sm501_register_gpio(struct sm501_devdata *sm)
>  	iounmap(gpio->regs);
>  
>   err_claimed:
> -	release_resource(gpio->regs_res);
> -	kfree(gpio->regs_res);
> +	release_mem_region(iobase, 0x20);
>  
>  	return ret;
>  }
> @@ -1095,6 +1094,7 @@ static int sm501_register_gpio(struct sm501_devdata *sm)
>  static void sm501_gpio_remove(struct sm501_devdata *sm)
>  {
>  	struct sm501_gpio *gpio = &sm->gpio;
> +	resource_size_t iobase = sm->io_res->start + SM501_GPIO;

Shouldn't this be 'struct resource *'?

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2019-12-09  9:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-16 15:13 [PATCH] mfd: sm501: fix mismatches of request_mem_region Chuhong Yuan
2019-12-09  9:00 ` Lee Jones [this message]
2019-12-09  9:09   ` Chuhong Yuan
2019-12-09 13:13     ` Lee Jones
2019-12-09 13:13 ` Lee Jones

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=20191209090020.GG3468@dell \
    --to=lee.jones@linaro.org \
    --cc=hslester96@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox