[PATCH 8/9] reset: socfpga: error out on failure to request memory
Ahmad Fatoum
a.fatoum at pengutronix.de
Sat Oct 30 10:58:11 PDT 2021
IOMEM() can't fail, but dev_request_mem_resource() can. Fix the error
check.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/reset/reset-socfpga.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
index fc5c50e13ca9..146cc92eb3ce 100644
--- a/drivers/reset/reset-socfpga.c
+++ b/drivers/reset/reset-socfpga.c
@@ -84,9 +84,10 @@ static int socfpga_reset_probe(struct device_d *dev)
data = xzalloc(sizeof(*data));
res = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(res))
+ return PTR_ERR(res);
+
data->membase = IOMEM(res->start);
- if (IS_ERR(data->membase))
- return PTR_ERR(data->membase);
if (of_property_read_u32(np, "altr,modrst-offset", &modrst_offset)) {
dev_warn(dev, "missing altr,modrst-offset property, assuming 0x10!\n");
--
2.30.2
More information about the barebox
mailing list