From: Dan Streetman <ddstreet@ieee.org>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: Linux-MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/2] zpool: Use common error handling code in zpool_create_pool()
Date: Wed, 16 Aug 2017 07:19:40 -0400 [thread overview]
Message-ID: <CALZtONAL23OdgQauR28ToqVhvRz2yT9LhVq+8jm3C0g_WVMS6g@mail.gmail.com> (raw)
In-Reply-To: <54351127-7222-c578-10f7-ee0dbf8f7879@users.sourceforge.net>
On Mon, Aug 14, 2017 at 7:16 AM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 14 Aug 2017 13:04:33 +0200
>
> Add a jump target so that a bit of exception handling can be better reused
> in this function.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Dan Streetman <ddstreet@ieee.org>
> ---
> mm/zpool.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/mm/zpool.c b/mm/zpool.c
> index fe1943f7d844..e4634edef86d 100644
> --- a/mm/zpool.c
> +++ b/mm/zpool.c
> @@ -171,10 +171,8 @@ struct zpool *zpool_create_pool(const char *type, const char *name, gfp_t gfp,
> }
>
> zpool = kmalloc(sizeof(*zpool), gfp);
> - if (!zpool) {
> - zpool_put_driver(driver);
> - return NULL;
> - }
> + if (!zpool)
> + goto put_driver;
>
> zpool->driver = driver;
> zpool->pool = driver->create(name, gfp, ops, zpool);
> @@ -182,8 +180,9 @@ struct zpool *zpool_create_pool(const char *type, const char *name, gfp_t gfp,
>
> if (!zpool->pool) {
> pr_err("couldn't create %s pool\n", type);
> - zpool_put_driver(driver);
> kfree(zpool);
> +put_driver:
> + zpool_put_driver(driver);
> return NULL;
> }
>
> --
> 2.14.0
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2017-08-16 11:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-14 11:14 [PATCH 0/2] zpool: Adjustments for zpool_create_pool() SF Markus Elfring
2017-08-14 11:15 ` [PATCH 1/2] zpool: Delete an error message for a failed memory allocation in zpool_create_pool() SF Markus Elfring
2017-08-16 11:19 ` Dan Streetman
2017-08-14 11:16 ` [PATCH 2/2] zpool: Use common error handling code " SF Markus Elfring
2017-08-16 11:19 ` Dan Streetman [this message]
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=CALZtONAL23OdgQauR28ToqVhvRz2yT9LhVq+8jm3C0g_WVMS6g@mail.gmail.com \
--to=ddstreet@ieee.org \
--cc=elfring@users.sourceforge.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox