Commit 0d625a16 authored by Dinh Nguyen's avatar Dinh Nguyen Committed by Philipp Zabel

reset: socfpga: add error handling and release mem-region

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: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDinh Nguyen <dinguyen@kernel.org>
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent 3bfe8933
......@@ -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", &reg_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 ret;
release_region:
release_mem_region(res.start, size);
err_alloc:
kfree(data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment