From: Philipp Zabel <p.zabel@pengutronix.de>
To: Dinh Nguyen <dinguyen@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] reset: socfpga: add error handling and release mem-region
Date: Mon, 09 Nov 2020 11:45:38 +0100 [thread overview]
Message-ID: <b22b651f4bc8388024c760d73caedcc647596f59.camel@pengutronix.de> (raw)
In-Reply-To: <20201102195702.14496-1-dinguyen@kernel.org>
On Mon, 2020-11-02 at 13:57 -0600, Dinh Nguyen wrote:
> In case of an error, call release_mem_region when an error happens
> during allocation of resources. Also add error handling for the case
> that reset_controller_register fails.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
> ---
> drivers/reset/reset-socfpga.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
> index bdd984296196..af9041ec37c6 100644
> --- a/drivers/reset/reset-socfpga.c
> +++ b/drivers/reset/reset-socfpga.c
> @@ -44,7 +44,7 @@ static int a10_reset_init(struct device_node *np)
> data->membase = ioremap(res.start, size);
> if (!data->membase) {
> ret = -ENOMEM;
> - goto err_alloc;
> + goto release_region;
> }
>
> if (of_property_read_u32(np, "altr,modrst-offset", ®_offset))
> @@ -59,7 +59,14 @@ static int a10_reset_init(struct device_node *np)
> data->rcdev.of_node = np;
> data->status_active_low = true;
>
> - return reset_controller_register(&data->rcdev);
> + ret = reset_controller_register(&data->rcdev);
> + if (ret)
> + pr_err("unable to register device\n");
> +
> + return 0;
Please don't return 0 if reset_controller_register() failed.
regards
Philipp
prev parent reply other threads:[~2020-11-09 10:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 19:57 Dinh Nguyen
2020-11-09 10:45 ` Philipp Zabel [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=b22b651f4bc8388024c760d73caedcc647596f59.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=dinguyen@kernel.org \
--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
all inboxes | Powered by JetHome®