From: Simon Horman <horms@kernel.org>
To: Siva Reddy Kallam <siva.kallam@broadcom.com>
Cc: leonro@nvidia.com, jgg@nvidia.com, linux-rdma@vger.kernel.org,
netdev@vger.kernel.org, vikas.gupta@broadcom.com,
selvin.xavier@broadcom.com, anand.subramanian@broadcom.com,
usman.ansari@broadcom.com
Subject: Re: [PATCH v3 4/8] RDMA/bng_re: Allocate required memory resources for Firmware channel
Date: Mon, 24 Nov 2025 16:49:43 +0000 [thread overview]
Message-ID: <aSSMpzADtbAOBU2r@horms.kernel.org> (raw)
In-Reply-To: <20251117171136.128193-5-siva.kallam@broadcom.com>
On Mon, Nov 17, 2025 at 05:11:22PM +0000, Siva Reddy Kallam wrote:
...
> +static void bng_re_dev_uninit(struct bng_re_dev *rdev)
> +{
> + bng_re_free_rcfw_channel(&rdev->rcfw);
> + bng_re_destroy_chip_ctx(rdev);
> + if (test_and_clear_bit(BNG_RE_FLAG_NETDEV_REGISTERED, &rdev->flags))
> + bnge_unregister_dev(rdev->aux_dev);
> +}
> +
> static int bng_re_dev_init(struct bng_re_dev *rdev)
> {
> int rc;
> @@ -170,14 +184,18 @@ static int bng_re_dev_init(struct bng_re_dev *rdev)
>
> bng_re_query_hwrm_version(rdev);
>
> + rc = bng_re_alloc_fw_channel(&rdev->bng_res, &rdev->rcfw);
> + if (rc) {
> + ibdev_err(&rdev->ibdev,
> + "Failed to allocate RCFW Channel: %#x\n", rc);
> + goto fail;
> + }
> +
> return 0;
> -}
>
> -static void bng_re_dev_uninit(struct bng_re_dev *rdev)
> -{
> - bng_re_destroy_chip_ctx(rdev);
> - if (test_and_clear_bit(BNG_RE_FLAG_NETDEV_REGISTERED, &rdev->flags))
> - bnge_unregister_dev(rdev->aux_dev);
> +fail:
> + bng_re_dev_uninit(rdev);
> + return rc;
Hi Siva,
IMHO, I think that it would best to handle unwind using a ladder
of goto statements, that reverse the order of the incremental
initialisation performed by this function.
As is, this may not have much effect, other than seeming to duplicate
bng_re_dev_uninit(). But I think that as bng_re_dev_init() grows,
as it does in this patch-set, this will lead to clearer error handling
(and ideally a lower chance of bugs later).
I would also suggest that it would be best to name the label
after what tit does, rather than somewhat general name 'fail'.
> }
>
> static int bng_re_add_device(struct auxiliary_device *adev)
...
next prev parent reply other threads:[~2025-11-24 16:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 17:11 [PATCH v3 0/8] Introducing Broadcom BNG_RE RoCE Driver Siva Reddy Kallam
2025-11-17 17:11 ` [PATCH v3 1/8] bng_en: Add RoCE aux device support Siva Reddy Kallam
2025-11-17 17:11 ` [PATCH v3 2/8] RDMA/bng_re: Add Auxiliary interface Siva Reddy Kallam
2025-11-17 17:11 ` [PATCH v3 3/8] RDMA/bng_re: Register and get the resources from bnge driver Siva Reddy Kallam
2025-11-17 17:11 ` [PATCH v3 4/8] RDMA/bng_re: Allocate required memory resources for Firmware channel Siva Reddy Kallam
2025-11-24 16:49 ` Simon Horman [this message]
2025-11-25 10:35 ` Siva Reddy Kallam
2025-11-17 17:11 ` [PATCH v3 5/8] RDMA/bng_re: Add infrastructure for enabling " Siva Reddy Kallam
2025-11-20 16:02 ` Leon Romanovsky
2025-11-24 16:44 ` Simon Horman
2025-11-25 6:33 ` Siva Reddy Kallam
2025-11-17 17:11 ` [PATCH v3 6/8] RDMA/bng_re: Enable Firmware channel and query device attributes Siva Reddy Kallam
2025-11-17 17:11 ` [PATCH v3 7/8] RDMA/bng_re: Add basic debugfs infrastructure Siva Reddy Kallam
2025-11-17 17:11 ` [PATCH v3 8/8] RDMA/bng_re: Initialize the Firmware and Hardware Siva Reddy Kallam
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=aSSMpzADtbAOBU2r@horms.kernel.org \
--to=horms@kernel.org \
--cc=anand.subramanian@broadcom.com \
--cc=jgg@nvidia.com \
--cc=leonro@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=selvin.xavier@broadcom.com \
--cc=siva.kallam@broadcom.com \
--cc=usman.ansari@broadcom.com \
--cc=vikas.gupta@broadcom.com \
/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;
as well as URLs for NNTP newsgroup(s).