summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhen Lei <thunder.leizhen@huawei.com>2021-04-28 14:32:03 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-14 13:48:16 +0200
commit5c3e241f5246445da29bd03783ca61a18face968 (patch)
tree28e548d0a7dbce5142db97e99ec59c2c5cf4377a
parenta6daf4bb5fcb893f7aa2a97e043ee11816743f81 (diff)
downloadlwn-5c3e241f5246445da29bd03783ca61a18face968.tar.gz
lwn-5c3e241f5246445da29bd03783ca61a18face968.zip
lib: devres: Add error information printing for __devm_ioremap_resource()
Ensure that all error handling branches print error information. In this way, when this function fails, the upper-layer functions can directly return an error code without missing debugging information. Otherwise, the error message will be printed redundantly or missing. Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Link: https://lore.kernel.org/r/20210428063203.691-1-thunder.leizhen@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--lib/devres.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/devres.c b/lib/devres.c
index 4679dbb1bf5f..bdb06898a977 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -157,8 +157,10 @@ __devm_ioremap_resource(struct device *dev, const struct resource *res,
dev_name(dev), res->name);
else
pretty_name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL);
- if (!pretty_name)
+ if (!pretty_name) {
+ dev_err(dev, "can't generate pretty name for resource %pR\n", res);
return IOMEM_ERR_PTR(-ENOMEM);
+ }
if (!devm_request_mem_region(dev, res->start, size, pretty_name)) {
dev_err(dev, "can't request region for resource %pR\n", res);