[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b22b651f4bc8388024c760d73caedcc647596f59.camel@pengutronix.de>
Date: Mon, 09 Nov 2020 11:45:38 +0100
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Dinh Nguyen <dinguyen@...nel.org>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] reset: socfpga: add error handling and release
mem-region
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@...el.com>
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Dinh Nguyen <dinguyen@...nel.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
Powered by blists - more mailing lists