From: Masahiro Yamada <yamada.masahiro@socionext.com> To: linux-arm-kernel@lists.infradead.org Cc: Masahiro Yamada <yamada.masahiro@socionext.com>, Russell King <linux@armlinux.org.uk>, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] ARM: cache-uniphier: refactor jump label to follow coding style guideline Date: Fri, 4 Nov 2016 20:43:35 +0900 [thread overview] Message-ID: <1478259816-24965-3-git-send-email-yamada.masahiro@socionext.com> (raw) In-Reply-To: <1478259816-24965-1-git-send-email-yamada.masahiro@socionext.com> Documentation/CodingStyle recommends to use label names which say what the goto does or why the goto exists. Just in case, split it up into three labels because the CodingStyle says "one err bugs" is a common type of bug (although, I do not believe the current code includes such a bug). During the refactoring, iounmap(data->op_base) turned out to have no corresponding bail-out point, so remove it. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- arch/arm/mm/cache-uniphier.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/arm/mm/cache-uniphier.c b/arch/arm/mm/cache-uniphier.c index 58f2ddb..c71ab7c 100644 --- a/arch/arm/mm/cache-uniphier.c +++ b/arch/arm/mm/cache-uniphier.c @@ -387,21 +387,21 @@ static int __init __uniphier_cache_init(struct device_node *np, if (!data->ctrl_base) { pr_err("L%d: failed to map control register\n", *cache_level); ret = -ENOMEM; - goto err; + goto free_mem; } data->rev_base = of_iomap(np, 1); if (!data->rev_base) { pr_err("L%d: failed to map revision register\n", *cache_level); ret = -ENOMEM; - goto err; + goto unmap_ctrl; } data->op_base = of_iomap(np, 2); if (!data->op_base) { pr_err("L%d: failed to map operation register\n", *cache_level); ret = -ENOMEM; - goto err; + goto unmap_rev; } data->way_ctrl_base = data->ctrl_base + 0xc00; @@ -451,10 +451,12 @@ static int __init __uniphier_cache_init(struct device_node *np, of_node_put(next_np); return ret; -err: - iounmap(data->op_base); + +unmap_rev: iounmap(data->rev_base); +unmap_ctrl: iounmap(data->ctrl_base); +free_mem: kfree(data); return ret; -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: yamada.masahiro@socionext.com (Masahiro Yamada) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] ARM: cache-uniphier: refactor jump label to follow coding style guideline Date: Fri, 4 Nov 2016 20:43:35 +0900 [thread overview] Message-ID: <1478259816-24965-3-git-send-email-yamada.masahiro@socionext.com> (raw) In-Reply-To: <1478259816-24965-1-git-send-email-yamada.masahiro@socionext.com> Documentation/CodingStyle recommends to use label names which say what the goto does or why the goto exists. Just in case, split it up into three labels because the CodingStyle says "one err bugs" is a common type of bug (although, I do not believe the current code includes such a bug). During the refactoring, iounmap(data->op_base) turned out to have no corresponding bail-out point, so remove it. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- arch/arm/mm/cache-uniphier.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/arm/mm/cache-uniphier.c b/arch/arm/mm/cache-uniphier.c index 58f2ddb..c71ab7c 100644 --- a/arch/arm/mm/cache-uniphier.c +++ b/arch/arm/mm/cache-uniphier.c @@ -387,21 +387,21 @@ static int __init __uniphier_cache_init(struct device_node *np, if (!data->ctrl_base) { pr_err("L%d: failed to map control register\n", *cache_level); ret = -ENOMEM; - goto err; + goto free_mem; } data->rev_base = of_iomap(np, 1); if (!data->rev_base) { pr_err("L%d: failed to map revision register\n", *cache_level); ret = -ENOMEM; - goto err; + goto unmap_ctrl; } data->op_base = of_iomap(np, 2); if (!data->op_base) { pr_err("L%d: failed to map operation register\n", *cache_level); ret = -ENOMEM; - goto err; + goto unmap_rev; } data->way_ctrl_base = data->ctrl_base + 0xc00; @@ -451,10 +451,12 @@ static int __init __uniphier_cache_init(struct device_node *np, of_node_put(next_np); return ret; -err: - iounmap(data->op_base); + +unmap_rev: iounmap(data->rev_base); +unmap_ctrl: iounmap(data->ctrl_base); +free_mem: kfree(data); return ret; -- 1.9.1
next prev parent reply other threads:[~2016-11-04 11:42 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-11-04 11:43 [PATCH 0/3] ARM: cache-uniphier: slight cleanups and trivial coding style fix Masahiro Yamada 2016-11-04 11:43 ` Masahiro Yamada 2016-11-04 11:43 ` [PATCH 1/3] ARM: cache-uniphier: call kzalloc() after DT property parsing Masahiro Yamada 2016-11-04 11:43 ` Masahiro Yamada 2016-11-04 11:43 ` Masahiro Yamada [this message] 2016-11-04 11:43 ` [PATCH 2/3] ARM: cache-uniphier: refactor jump label to follow coding style guideline Masahiro Yamada 2016-11-04 12:23 ` Russell King - ARM Linux 2016-11-04 12:23 ` Russell King - ARM Linux 2016-11-04 12:50 ` Masahiro Yamada 2016-11-04 12:50 ` Masahiro Yamada 2016-11-04 13:32 ` Russell King - ARM Linux 2016-11-04 13:32 ` Russell King - ARM Linux 2016-11-05 3:17 ` Masahiro Yamada 2016-11-05 3:17 ` Masahiro Yamada 2016-11-04 11:43 ` [PATCH 3/3] ARM: cache-uniphier: clean up active way setup code Masahiro Yamada 2016-11-04 11:43 ` Masahiro Yamada
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=1478259816-24965-3-git-send-email-yamada.masahiro@socionext.com \ --to=yamada.masahiro@socionext.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@armlinux.org.uk \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.