Re: [PATCH 04/13] nvdimm/btt: use goto error labels on btt_blk_init()

From
Dan Williams <hidden>
Date
2021-10-31 17:51:21
Also in
linux-nvme, linuxppc-dev, lkml, nvdimm
Reply to
Luis Chamberlain, 2021-10-15
On Fri, Oct 15, 2021 at 4:53 PM Luis Chamberlain [off-list ref] wrote:
quoted hunk ↗ jump to hunk
This will make it easier to share common error paths.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 drivers/nvdimm/btt.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index 29cc7325e890..23ee8c005db5 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1520,10 +1520,11 @@ static int btt_blk_init(struct btt *btt)
 {
        struct nd_btt *nd_btt = btt->nd_btt;
        struct nd_namespace_common *ndns = nd_btt->ndns;
+       int rc = -ENOMEM;

        btt->btt_disk = blk_alloc_disk(NUMA_NO_NODE);
        if (!btt->btt_disk)
-               return -ENOMEM;
+               goto out;
I tend to not use a goto when there is nothing to unwind.

The rest looks good to me. After dropping "goto out;" you can add:

Reviewed-by: Dan Williams <redacted>
Thread (36 messages) 36 messages, 8 authors, last reply 2021-11-03
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help