* [PATCH 0/2] zpool: Adjustments for zpool_create_pool() @ 2017-08-14 11:14 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-14 11:16 ` [PATCH 2/2] zpool: Use common error handling code " SF Markus Elfring 0 siblings, 2 replies; 5+ messages in thread From: SF Markus Elfring @ 2017-08-14 11:14 UTC (permalink / raw) To: linux-mm, Dan Streetman; +Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 14 Aug 2017 13:12:34 +0200 Two update suggestions were taken into account from static source code analysis. Markus Elfring (2): Delete an error message for a failed memory allocation Use common error handling code mm/zpool.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 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> ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] zpool: Delete an error message for a failed memory allocation in zpool_create_pool() 2017-08-14 11:14 [PATCH 0/2] zpool: Adjustments for zpool_create_pool() SF Markus Elfring @ 2017-08-14 11:15 ` 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 1 sibling, 1 reply; 5+ messages in thread From: SF Markus Elfring @ 2017-08-14 11:15 UTC (permalink / raw) To: linux-mm, Dan Streetman; +Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 14 Aug 2017 12:57:16 +0200 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- mm/zpool.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mm/zpool.c b/mm/zpool.c index fd3ff719c32c..fe1943f7d844 100644 --- a/mm/zpool.c +++ b/mm/zpool.c @@ -172,7 +172,6 @@ struct zpool *zpool_create_pool(const char *type, const char *name, gfp_t gfp, zpool = kmalloc(sizeof(*zpool), gfp); if (!zpool) { - pr_err("couldn't create zpool - out of memory\n"); 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> ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] zpool: Delete an error message for a failed memory allocation in zpool_create_pool() 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 0 siblings, 0 replies; 5+ messages in thread From: Dan Streetman @ 2017-08-16 11:19 UTC (permalink / raw) To: SF Markus Elfring; +Cc: Linux-MM, LKML, kernel-janitors On Mon, Aug 14, 2017 at 7:15 AM, SF Markus Elfring <elfring@users.sourceforge.net> wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Mon, 14 Aug 2017 12:57:16 +0200 > > Omit an extra message for a memory allocation failure in this function. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Dan Streetman <ddstreet@ieee.org> > --- > mm/zpool.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/mm/zpool.c b/mm/zpool.c > index fd3ff719c32c..fe1943f7d844 100644 > --- a/mm/zpool.c > +++ b/mm/zpool.c > @@ -172,7 +172,6 @@ struct zpool *zpool_create_pool(const char *type, const char *name, gfp_t gfp, > > zpool = kmalloc(sizeof(*zpool), gfp); > if (!zpool) { > - pr_err("couldn't create zpool - out of memory\n"); > 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> ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] zpool: Use common error handling code in zpool_create_pool() 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-14 11:16 ` SF Markus Elfring 2017-08-16 11:19 ` Dan Streetman 1 sibling, 1 reply; 5+ messages in thread From: SF Markus Elfring @ 2017-08-14 11:16 UTC (permalink / raw) To: linux-mm, Dan Streetman; +Cc: LKML, kernel-janitors 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> --- 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> ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] zpool: Use common error handling code in zpool_create_pool() 2017-08-14 11:16 ` [PATCH 2/2] zpool: Use common error handling code " SF Markus Elfring @ 2017-08-16 11:19 ` Dan Streetman 0 siblings, 0 replies; 5+ messages in thread From: Dan Streetman @ 2017-08-16 11:19 UTC (permalink / raw) To: SF Markus Elfring; +Cc: Linux-MM, LKML, kernel-janitors 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> ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-08-16 11:20 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).